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