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

How can I get this script to work?

function onTouch(part)
    if part.Parent:FindFirstChild("Humanoid") then 
        local piggy = game.Players:GetPlayerFromCharacter(part.Parent) 
        if piggy.TeamColor ~= BrickColor.new("Institutional white") then
			piggy.Neutral = false
        	piggy.TeamColor = BrickColor.new("Institutional white")
		end
	end
end

script.Parent.Touched:connect(onTouch)

for i,v in pairs(game.Players:GetPlayers()) do
	v.Character:MoveTo(Vector3.new(108, 11.19, -29))
end
wait(1)

How can I get this so its just in one script, no part needed and it changes the players team back to Lobby and moves them back to those coords

1 answer

✓ Accepted answer

Yeah, that wouldn't work. Define the player, and make sure that the part that touched the brick is part of a human.

function onTouch(part)
	if part.Parent:FindFirstChild("Humanoid") then --If part is part of a human
		local piggy = game.Players:GetPlayerFromCharacter(part.Parent) --Gets the player from the human. part.Parent is the Character model.
		if piggy.TeamColor ~= "Institutional White" then
		piggy.Neutral = false
		piggy.TeamColor = BrickColor.new("Institutional White")
	end
end
end

script.Parent.Touched:connect(onTouch)

13 comments

0

Change line 4 to "if piggy.TeamColor ~= BrickColor.new'Institutional White' then"

0

You forgot an and

0

2 actually

0

It made me back to insti white, But, It says my team was Neutral, I want it to say Lobby, cause I have three teams, Killer, Runner, and Lobby

0

pffft minor details lol, and if it says the team is Neutral, then just set Player.Neutral to false. Teams are annoying, they should make it also by name, not by colour.

0

Ok so, where is Player.Neutral, and also, your pretty good if you only started a month ago?

0

I changed the script, but, there still is Neutral?

0

I know whats wrong, its a lowercase W with White

0

Okay great :) also thanks.

0

It now works :D Thanks edit it to lowercase W and I'll accept answer

0

Copy my script and change the W to w

0

Also do you know of a way that I can convert that so it works from just inside a script, like have a wait(2) above and below it, so it moves players to a place on the map. I'll show you what I have for it and explain in higher detail in the question

0

I have editted, think you could help out?

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