#[SOLVED] how to add an attribute to the players character?

1 messages · Page 1 of 1 (latest)

spare bronze
#

I want to add an attribute to every player that joins the game. So i made script like this but it didnt work:

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character:SetAttribute("Hiding", true)
    end)
end)
green sentinel
#

That adds it to the character not the player

slow pollen
spare bronze
#

how to add an attribute to the players character?

slow pollen
spare bronze
slow pollen
#

I wouldn't be able to tell you to be honest, your code works just fine if that's what you're worried about.

spare bronze
#

but the character doesnt have the attribute

#

idk why

slow pollen
#

Are you using :GetAttribute() on the model or the player? The model is under workspace, that's what Player.Character is, player is a child of game:GetService("Players")

spare bronze
#

yeah

#

im using :SetAttribute() whenever player joins and i added the print() statement to check

#

and there's no print in the output

#
Players.PlayerAdded:Connect(function(player)
    local character = player.Character or player.CharacterAdded:Wait()
    character:SetAttribute("Hiding", true)
    print("Set the attribute to the player:" .. character.Name)
end)
slow pollen
#

You don't see the print line in the output window? And you're sure you have the correct window open?

spare bronze
#

nope

slow pollen
#

Sus

#

Where is the Script in your game heirarchy?

spare bronze
#

ServerScriptService

#

ik why was that

#

hahahha

#

thats so stupid

#

okay now its working

#

it was cus i had task.wait(1) at the beggining of the script

#

thanx anyways