local tool = game.StarterPack.Tool tool.Equipped:Connect(function() script.Parent.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChild("Humanoid") local p = game.Players:GetPlayerFromCharacter(hit.Parent) local stats = p:FindFirstChild("leaderstats").Water if hum and p and stats then stats.Value = stats.Value + 1 end end) tool.Unequipped:Connect(function() script.Parent.Touched:Connect(function(hit) local hum = hit.ParentFindFirstChild if hum then wait() end end) end) end)
this is a server script parented to a part it's supposed to add 1 to the "Water" value whenever the part is touched while a certain tool is equipped i don't get it what am i doing wrong
On line 13, you missed a colon and a parentheses... that might fix your issue.
local tool = game.StarterPack.Tool tool.Equipped:Connect(function() script.Parent.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChild("Humanoid") local p = game.Players:GetPlayerFromCharacter(hit.Parent) local stats = p:FindFirstChild("leaderstats").Water if hum and p and stats then stats.Value = stats.Value + 1 end end) tool.Unequipped:Connect(function() script.Parent.Touched:Connect(function(hit) local hum = hit.Parent:FindFirstChild() if hum then wait() end end) end) end)