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

How to make the spawn AllowTeamChangeOnTouch?

Asked by
wjs3456 90
10 years ago

I tried using this script to make it so when you touched it you could change to its team, but then after a second it wouldn't. (This is the beginning of a round)

game.Workspace.Field1.Spawn1.AllowTeamChangeOnTouch = true
            wait(1)
            game.Workspace.Field1.Spawn1.AllowTeamChangeOnTouch = false

It didn't work obviously. Is there anyway to fix this?

3 answers

Log in to vote
0
Answered by 10 years ago

What do you mean it didnt work? If you were to logically translate this in English. It would be: You can changes teams...(One second passes by) You cant change teams. You're changing window is only open for 1 seconds. Then it becomes false. I don't get what's to fix.

0
It doesn't do anything whatsoever wjs3456 90 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

how are you calling this in your script?? Because if you don't have this in a function it will execute as soon it loads the script.

are you calling like this game.Workspace.Field1.Spawn1.Touched:connect(Value_Changer)?


function Value_Changer() game.Workspace.Field1.Spawn1.AllowTeamChangeOnTouch = true wait(1) game.Workspace.Field1.Spawn1.AllowTeamChangeOnTouch = false end
0
It is in a function wjs3456 90 — 10y
0
Is the script disabled? Are you calling the function? Perci1 4988 — 10y
0
@wjs3456 look at my answer hockey1scool 10 — 10y
Log in to vote
0
Answered by
jakedies 315 Trusted Moderation Voter Administrator Community Moderator
10 years ago

It would probably be better to keep that property enabled. Or for some reason if you want it disabled, change the player who touched the spawn's TeamColor property to the Spawn's TeamColor property.

local part = game.Workspace.Field1.Spawn1;
part.Touched:connect(function(hit)
    local player = hit and hit.Parent and Game.Players:GetPlayerFromCharacter(hit.Parent);
    if player then
        player.TeamColor = part.TeamColor;
        player.Neutral = part.Neutral; --Just to make sure they are neutral if the spawn is neutral.
    end
end);

Answer this question