#WHY THE HELL WONT IT WORK IF I MAKE IT CHECK WHAT TEAM THE PLAYER IS ON

1 messages · Page 1 of 1 (latest)

hidden pebble
#

dont mention the old character variable

#

i just fogot to remove it when i changed the code

torn charm
#

could you explain what isnt working

#

be specific

hidden pebble
#

if i make it check for the player's team the character change doesnt happen

#

@torn charm

torn charm
#

have you debugged it yet

hidden pebble
#

nothing shows up

surreal wren
#

@hidden pebble

#

check if the part touched actually is a player

#

by doing

torn charm
#

he says it only doesnt work if he checks player team

surreal wren
#

if Part.Parent:FindFirstChild("Humanoid") then

torn charm
#

that already implies the touch works already

hidden pebble
#

the touching part works

surreal wren
#

oh alr 1 sec

hidden pebble
#

its just that the character doesnt change if i make it check the players team in ANY way

quaint martenBOT
#

studio** You are now Level 11! **studio

hidden pebble
#

literraly empty

torn charm
#

can you send the code here in chat so i can easily edit it

surreal wren
#

wait what does it print if you put print(plr.Team)

hidden pebble
#

somehow prints monke even tho i placed it BEFORE the plr.team = monke

torn charm
hidden pebble
torn charm
hidden pebble
#

only way to get it is touching the brick

torn charm
#

send the coe here

#

code

#

text

hidden pebble
#

code text?

torn charm
#

yea

hidden pebble
#

--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)

surreal wren
#

is human ato assignable true?

#

also make sure the teamcolors are different

torn charm
#
--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

hidden pebble
#

ok

#

empty for some reason

surreal wren
#

it cant be empty

hidden pebble
#

all it did was once again change my team

surreal wren
#

something ur doing with output is wrong

hidden pebble
#

idk bro

surreal wren
#

cuz it cant be empty

hidden pebble
#

the oter stuff with the output works

#

why did it randomly work

torn charm
#

show a video of you starting the game, spawning as human, and touching the part WHILE output is open

hidden pebble
#

i dont have obs

#

something showed up rn

surreal wren
#

close studio and re open

hidden pebble
#

after a while

surreal wren
#

that should fix output

hidden pebble
#

after standing for a bit ti showed this

surreal wren
#

there we are

torn charm
#

replace print(plr.Name, plr.Team.Name) with print(plr.Name, plr.Team and plr.Team.Name or "")

hidden pebble
#

wait

torn charm
#

to get rid of the error

hidden pebble
#

i think i found a fix

torn charm
#

ok

hidden pebble
#

im such a dumbass

#

i found a fix

#

ty everyone for the help

#

appericate it

surreal wren
#

wait im curious