Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Voting system, no error, doesn't work?

local value = script.Parent.Value.Value
script.Parent.Touched:connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		script.Parent.Value.Value = script.Parent.Value.Value + 1
		script.Parent.SurfaceGui.TextLabel.Text = "Desert Map - " .. value
	end
end)
script.Parent.TouchEnded:connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then	
		script.Parent.Value.Value = script.Parent.Value.Value - 1
		script.Parent.SurfaceGui.TextLabel.Text = "Desert Map - " .. value
	end
end)

the script should change a textlabel but when a player steps on it, it doesn't do that.

3 comments

0

Try "if hit.Parent:FindFirstChild("Humanoid")" instead.

0

on line 3, do "if hit.Parent:FindFirstChild("Humanoid") then" and on line line 9, the same thing. "if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then" doesnt do anything but create alot of lag in the syntax of the script. it messes the the system up

0

tried, text didn't change, but thanks for the notice, i'll start to change the scripts from now on

1 answer

on line 3, do "if hit.Parent:FindFirstChild("Humanoid") then" and on line line 9, the same thing. "if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then" doesnt do anything but create alot of lag in the syntax of the script. it messes the the system up`

if hit.Parent:FindFirstChild("Humanoid") then

This discussion is preserved as it was. New answers, comments, and votes are closed.