I have a Character added function and it’s not running when I respawn
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Equipped = false
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
Player.CharacterAdded:Connect(function()
print(Equipped)
if Equipped == true then
script.Parent.SnowgearGUI.Enabled = true
end
end)
ReplicatedStorage.SnowgearGuiEvent.OnClientEvent:Connect(function()
script.Parent.SnowgearGUI.Enabled = true
Equipped = true
end)
ReplicatedStorage.FreezingEvent.OnClientEvent:Connect(function()
script.Parent.FreezingGUI.Enabled = true
end)
The Character Added function prints nothing when I respawn, leading me to believe it’s not running.
(The Code in it also doesn’t work)
1 Like
is this a script or a local script and try to do
and try to use the player from the playeradded event
Players.PlayerAdded:Connect(function(player)
player.characteradded:connect(fuction(character)
end)
end)
The script is in a Local Script.
it appears that this script should work, are you sure it isn’t disabled?
where u think the script is because if it is under startercharacter then everytime the character respawns the stuff wil run you wont need a characteradded event
The rest of the Code (the RemoveEvents) run perfectly fine, so no.
i ran it in studio, and it worked perfectly fine for me. Make sure that you aren’t searching anything in the output bar and that the one option’s box in the top left is set to all messages and the other one set to all contexts.
I disabled Reset on Spawn and it works lol. Thank you though.
Forummer
(Forummer)
June 23, 2022, 8:32pm
#9
local Character = Player.Character or Player.CharacterAdded:Wait()
Use this instead, if the script is in the StarterGui container.