so when i buy a tool from shop my tools damage script wont run.
my damage script:
local tool = script.Parent local Damage = 7 local debouce = false local Holding = false tool.Equipped:Connect(function() Holding=true end) tool.Unequipped:Connect(function() Holding=false end) tool:WaitForChild("blade").Touched:Connect (function (hit) if hit.Parent:FindFirstChild("Humanoid") and debouce == false and Holding == true then debouce = true hit.Parent.Humanoid:TakeDamage(Damage) wait(.5) debouce = false end end)
my shop script:
local player = game.Players.LocalPlayer local Saber = game.ReplicatedStorage.Weapons["Sith Saber"] script.Parent.MouseButton1Down:Connect(function() if player.leaderstats.Cash.Value >= 40 then player.leaderstats.Cash.Value = player.leaderstats.Cash.value - 40 Saber:Clone().Parent = player:WaitForChild("Backpack") end end)
So you would need to fire a remote event and give the player the tool on the server.
Local Script
local player = game.Players.LocalPlayer local Remote = YOUREMOTEDIRECTORY --YOURREMOTEDIRECTORY script.Parent.MouseButton1Down:Connect(function() Remote:FireServer(40) end)
Server Script
local Remote = YOUREMOTEDIRECTORY --YOURREMOTEDIRECTORY local Saber = game.ReplicatedStorage.Weapons["Sith Saber"] Remote.OnServerEvent:Connect(function(player, price) if player.leaderstats.Cash.Value >= price then Saber:Clone.Parent = player.Backpack Saber:Clone().Parent = player.StarterGear --Just so it stays when respawned end end)
Also, I would suggest putting the remote in ReplicatedStorage and make sure to define it in the variables I have placed.