Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I get this script to work?

Asked by 10 years ago
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

Log in to vote
1
Answered by 10 years ago

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)
0
Change line 4 to "if piggy.TeamColor ~= BrickColor.new'Institutional White' then" Bebee2 195 — 10y
0
You forgot an and NinjoOnline 1146 — 10y
0
2 actually NinjoOnline 1146 — 10y
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 NinjoOnline 1146 — 10y
View all comments (9 more)
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. infalliblelemon 145 — 10y
0
Ok so, where is Player.Neutral, and also, your pretty good if you only started a month ago? NinjoOnline 1146 — 10y
0
I changed the script, but, there still is Neutral? NinjoOnline 1146 — 10y
0
I know whats wrong, its a lowercase W with White NinjoOnline 1146 — 10y
0
Okay great :) also thanks. infalliblelemon 145 — 10y
0
It now works :D Thanks edit it to lowercase W and I'll accept answer NinjoOnline 1146 — 10y
0
Copy my script and change the W to w NinjoOnline 1146 — 10y
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 NinjoOnline 1146 — 10y
0
I have editted, think you could help out? NinjoOnline 1146 — 10y
Ad

Answer this question