So, I recently started scripting and I decided to try to make a fireball(tool) that launches when I click, This local script is in StarterPack, it's the tool's child:
local tool = script.Parent
local debounce = false
local remote = game:GetService("ReplicatedStorage"):WaitForChild("FireballTool")
tool.Equipped:connect(function(mouse)
if not debounce then
debounce = true
mouse.Button1Down:connect(function()
remote:FireServer()
end)
wait(5)
debounce = false
end
end)
(Also, I tried to add a cooldown with debounce, but it didn't work. what did I do wrong?)
This script is in ServerScriptService( and yes, I added a remote event called FireballTool in ReplicatedStorage)
Player = game.Players.LocalPlayer
local remote = game:GetService("ReplicatedStorage"):WaitForChild("FireballTool")
remote.OnServerEvent:Connect(function(Player)
local fireball = Instance.new("Part")
fireball.BrickColor = BrickColor.new("Maroon")
fireball.Transparency = 0.4
fireball.Shape = "Ball"
fireball.TopSurface = "Smooth"
fireball.BottomSurface = "Smooth"
fireball.CanCollide = false
fireball.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new (2,1,-12)
local bv = Instance.new("BodyVelocity",fireball)
bv.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 85
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
fireball.Parent = workspace
wait(2)
fireball:remove()
end)
This also happened with other things I tried to make, like animations and other abilities, when I test play in roblox studio it works fine, but in the game from roblox it doesn't work at all.
