local fireball = script.Parent
local vectorForce = fireball.VectorForce
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
vectorForce.Force = Vector3.new(1, workspace.Gravity * fireball:GetMass(), 0)
Fireball
Umieść obiekt Fireball w ServerStorage, do Fireball dodaj VectorForce
W ReplicatedStorage dodaj Remote event o nazwie FireballRE
Local script w StarterPlayerScripts
local userInp = game:GetService("UserInputService")
local debounce = false
userInp.InputBegan:Connect(function(input, isTyping)
if debounce then return end
if isTyping then return end
if input.KeyCode == Enum.KeyCode.X then
game.ReplicatedStorage.FireballRE:FireServer()
debounce = true
wait(2)
debounce = false
end
end)
Skrypt w ServiceScriptService
local fireballTemp = game.ServerStorage:WaitForChild("Fireball")
local speed = 800
game.ReplicatedStorage.FireballRE.OnServerEvent:Connect(function(player)
local char = player.Character
local lookDir = char.HumanoidRootPart.CFrame.lookVector
local fireball = fireballTemp:Clone()
fireball.CFrame = char.HumanoidRootPart.CFrame + lookDir*4
local vectorForce = fireball.VectorForce
vectorForce.Force = Vector3.new(
lookDir.X * speed,
workspace.Gravity*fireball:GetMass(),
lookDir.Z * speed)
fireball.Parent = workspace
local touchEvent
touchEvent = fireball.Touched:Connect(function(other)
if other.Parent:FindFirstChild("Humanoid") then
if other.Parent.Name ~= player.Name then
other.Parent:BreakJoints()
if touchEvent then touchEvent:Disconnect() end
fireball:Destroy()
end
end
end)
wait(3)
if touchEvent then touchEvent:Disconnect() end
fireball:Destroy()
end)