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

VIP Line 7 returns to a nil value?

Workspace.VIP.VIPDoorScript:7: attempt to index global 'Players' (a nil value)

Thats what it says in the output.

VIP = game.Workspace.VIP

TShirt = game.Workspace.TShirt
ID = TShirt.Graphic

function onTouched(hit)
	if Players.TShirt.ID == "http://www.roblox.com/The-Games-VIP-T-shirt-item?id=154826128" then
		VIP.Transparency = 1
		VIP.CanCollide = false
		wait(2)
		VIP.Transparency = 0
		VIP.CanCollide = true
	else
		if Players.TShirt.ID ~= "http://www.roblox.com/The-Games-VIP-T-shirt-item?id=154826128" then
			game.Workspace.Players:GetPlayers("Humanoid")
			Players.Humanoid.Health = 0
		end
		end
end

script.Parent.Touched:connect(onTouched)

I don't see whats the problem? Why?

1 answer

✓ Accepted answer

You haven't defined what 'Players' is.

local Players = game.Players:GetPlayerFromCharacter(hit.Parent)

Put that just under the start of the function.

1 comment

0

Ahh! Thanks!

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