Please help with the script

Please help me. I want to write code that will add an attribute to the player when he enters, but it doesn’t work. Don’t judge me harshly, I’m a novice developer.

Script:
local player = game.Players.LocalPlayer

function hiyu()
    player:SetAttribute("HaveTicket")
end

game.Players.PlayerAdded:Connect(hiyu)

The script is located in StarterPlayerScripts

I apologize if it is written strangely or incorrectly. I use a translator because I do not know English.

Code:

local player = game.Players.LocalPlayer

local function hiyu()
    player:SetAttribute("HaveTicket", true)
end

-- Run the function for the local player
hiyu()

You cannot use game.Players.PlayerAdded because it is a server event and your script is client

2 Likes

that right you can’t use some function in client

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.