Hiya! I'm IwuvPikachu and I absolutely suck at scripting. But hey, everyone has to start somewhere... anyways, here's my question:
I'm trying to script a block so that whenever it is touched by another block, it gives a point to everyone on the server.
Here's what my feeble coding ability could come up with:
function onTouched(hit)
if hit.Name == "Part" then
local players = game.Players:GetChildren()
local stats = players:findFirstChild("leaderstats")
if stats ~= nil then
local Points = stats:findFirstChild("Points")
Points.Value = Points.Value +1
end
end
script.Parent.Touched:Connect(onTouched)
As you can probably tell, it doesn't work. If you could please point me toward the right method to write this, you would make my day!
I understand that this script will only work if the brick that touches it is explicitly named "Part", and that is okay. If I had to guess, I would say my problem lies in telling the script to add a point to all players on the server? But I'm not sure. Again, thank you in advance for your help!

1 comment
Goodness, that script did not copypaste well. Let me try to fix that for easier reading ^-^"