There are two errors in that script: touches is a number value and Text has to be a string value, you can't mix them and LocalPlayer is a player, you have to connect the body parts to the function.
Fix:
local player = game.Players.LocalPlayer
local touches = 0
function Touched()
touches = touches + 1
player.PlayerGui.ScreenGui.TextLabel.Text = tostring(touches)
end
for child, index in pairs (game.Players.LocalPlayer.Character:GetChildren()) do
if child:IsA("Part") then
child.Touched:connect(Touched)
end
end
6 comments
Doesn't work at all.
You sure? I see not errors in that. No output?
Nothing in the output, it just doesn't work...
Is the locla script where it should be? In a player's Backpack (can be indirectly, through a Tool or HopperBin), in a player's character moel or in a player's PlayerGui.
It's in a Part in Workspace.
...oh god -> read this page, please: http://wiki.roblox.com/index.php?title=Local_script