I don’t understand how to write the path to the attribute.
I have attributes in the players, and I need to check whether it is enabled or not (Tone true or folse), but when I directly enter the path Game.players.MaxMixcat.HaveTicket (This is the name of the attribute), it turns out that it is not there . Either I don’t know how to write the attribute path correctly, or there’s something wrong with Roblox Studio. Can you please tell me what to do?
Sorry if it’s written poorly or incorrectly. I use a translator because I don’t know English.
How did you set the attribute? by?
Character:SetAttribute("HaveTicket ", true)
Or maybe you set it in the Player or Character?
And to check the attribute you use
local attribute = Player:GetAttribute("HaveTicket")
Player = game.Players.LocalPlayer
(I don’t know if the value of the variable is necessary, but let it be.)
So I set the attribute:
Player:SetAtribute(“HaveTicket”, false)
I think this is the first option.
I see that you are using .LocalPlayer, yes its the Player instance, but that means you are setting it on the Client side, from a LocalScript. If you try to check that Attribute from a Server Script, the Attribute wont exist, it will only exist on the side of the client.
Be sure that’s what you want, having the attribute only on client side. (mostly you dont want that, you want the server to control important stuff as “having a ticket” sounds)
So, in a client script you can simply do
local valueOfTicket = game.Players.LocalPlayer:GetAttribute(“HaveTicket”)
Only from a client/local script. You cant check it on server side
Thanks! you helped me a lot!
(I just don’t know any other place where you can create an attribute so that it applies specifically to a specific player.)
You can do it on a server script and apply it to a specific player, that Attribute will only exist for that specific player, but, the value exist on server side which is more secure, otherwise a client can change its own attribute if its on client side, and if your system relies on checking the attribute from client side, then the exploiter can change their values to whatever they want.
Thats why I suggested setting the attribute on server side, will be specifically for that player and only server has access to edit it, and all the checks of that value should be done in server too
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.