#WHY THE HELL WONT IT WORK IF I MAKE IT CHECK WHAT TEAM THE PLAYER IS ON
1 messages · Page 1 of 1 (latest)
if i make it check for the player's team the character change doesnt happen
@torn charm
have you debugged it yet
nothing shows up
he says it only doesnt work if he checks player team
if Part.Parent:FindFirstChild("Humanoid") then
that already implies the touch works already
the touching part works
oh alr 1 sec
its just that the character doesnt change if i make it check the players team in ANY way
** You are now Level 11! **
errors in output?
can you send the code here in chat so i can easily edit it
wait what does it print if you put print(plr.Team)
somehow prints monke even tho i placed it BEFORE the plr.team = monke
is the team already monke
no the player spawns and instantly gets set as human
so ur sure that game.Teams.Monke.AutoAssignable == false
yeah
only way to get it is touching the brick
code text?
yea
--Variables--
local Brick = script.Parent
--End--
--Code--
local function PlayerTouched(Part)
local Parent = Part.Parent
local plr = game.Players:GetPlayerFromCharacter(Parent)
if plr then
print(plr.Team)
local oldcharacter = plr.Character
local newcharacter = game.Workspace.monke:Clone()
newcharacter.HumanoidRootPart.Anchored = false
newcharacter:SetPrimaryPartCFrame(oldcharacter.PrimaryPart.CFrame)
plr.Character = newcharacter
newcharacter.Parent = workspace
task.wait(3)
plr.Team = game.Teams.Monke
end
end
Brick.Touched:connect(PlayerTouched)
--Variables--
local Brick = script.Parent
--End--
--Code--
local function PlayerTouched(Part)
print("Touched")
local Parent = Part.Parent
local plr = game.Players:GetPlayerFromCharacter(Parent)
print(plr.Name, plr.Team.Name)
if plr then
print(plr.Team.Name)
local oldcharacter = plr.Character
local newcharacter = workspace.monke:Clone()
newcharacter.HumanoidRootPart.Anchored = false
newcharacter:SetPrimaryPartCFrame(oldcharacter.PrimaryPart.CFrame)
plr.Character = newcharacter
newcharacter.Parent = workspace
task.wait(3)
plr.Team = game.Teams.Monke
end
end
Brick.Touched:connect(PlayerTouched)
show output
it cant be empty
all it did was once again change my team
something ur doing with output is wrong
idk bro
cuz it cant be empty
show a video of you starting the game, spawning as human, and touching the part WHILE output is open
close studio and re open
that should fix output
after standing for a bit ti showed this
there we are
replace print(plr.Name, plr.Team.Name) with print(plr.Name, plr.Team and plr.Team.Name or "")
wait
to get rid of the error
i think i found a fix
ok
wait im curious