This was working fine a while ago, but after I tried too expand with other ability ideas, I think I tinkered with something I should have, and stupidly didn't save.I also think I might be using something outdated. I can shoot out the "fireball" but when in a game with other people,it doesn't move but still hits as if it was moving. Thanks for any help (:
In serverscriptservice as regular script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService('Debris')
local Remote = ReplicatedStorage.FireBallEvent
local FireBall = ReplicatedStorage.FireBall
local Damage = 20
local ServerDebounces = {}
FireBall.Transparency = 0.5
FireBall.CanCollide = false
Remote.OnServerEvent:Connect(function(plr, Mouse)
if not ServerDebounces[plr] then
ServerDebounces[plr] = true
local Char = plr.Character or plr.CharacterAdded:Wait()
local FireBallClone = FireBall:Clone()
FireBallClone.CFrame = Char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
FireBallClone.Parent = workspace
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.Velocity = Mouse.lookVector
BodyVelocity.Parent = FireBallClone
spawn(function()
for i = 0, 1000 do
wait()
FireBallClone.Size = FireBallClone.Size + Vector3.new(0.25,0.025,0.025)
BodyVelocity.Velocity = Mouse.lookVector*100
end
end)
ServerDebounces[plr] = false
Debris:AddItem(FireBallClone, 10)
local Debounce = true
FireBallClone.Touched:Connect(function(h)
if h.Parent:FindFirstChild('Humanoid') and h.Parent.Name ~= plr.Name and Debounce then
Debounce = false
local Enemy = h.Parent.Humanoid
Enemy:TakeDamage(Damage)
FireBallClone.Transparency = 1
BodyVelocity:Destroy()
FireBallClone.Effect.Speed = NumberRange.new(8,8)
wait(1)
FireBallClone.Effect.Enabled = false
wait(1)
FireBallClone:Destroy()
wait(3)
Debounce = true
end
end)
end
end)
In Starter GUI as local script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local Remote = ReplicatedStorage.FireBallEvent
local Mouse = plr:GetMouse()
local Debounce = true
local Key = 'Q'
local Animation = Instance.new("Animation")
Animation.AnimationId = 'rbxassetid://2464206362'
UserInputService.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
local KeyPressed = Input.KeyCode
if KeyPressed == Enum.KeyCode[Key] and Debounce and Char then
Debounce = false
Remote:FireServer(Mouse.Hit)
local LoadAnimation = Char.Humanoid:LoadAnimation(Animation)
LoadAnimation:Play()
wait(3)
Debounce = true
end
end)
thanks again
