the script may be a little weird bc i repurposed my death screen script as a test, YES i’ve tried all the other ways you can find by google search.
script in starterplayerscripts
local Players = game:GetService("Players")
local Player = game:GetService("Players").LocalPlayer
local function onJoin()
local timeof = Players.LocalPlayer.PlayerGui:WaitForChild("timeof")
local sun = timeof.Frame.sun
if game.Lighting.ClockTime > 0 or game.Lighting.ClockTime < 17.7 then
game.SoundService.creek:Stop()
game.Players.LocalPlayer.PlayerScripts.LocalBackgroundMusic.BGM.Volume = 0
game.Players.LocalPlayer.PlayerScripts.LocalBackgroundMusic.BGM.PlaybackSpeed = 0
sun.Image = "http://www.roblox.com/asset/?id=((idhere))"
game.SoundService.creek:Play()
end
end
Players.PlayerAdded:Connect(onJoin)
Player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
end)
dont use player added on ur client u can use character added, if u would like to do something with your own character just do
local Player = game:GetService("Players").LocalPlayer
Player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
end)
As @NoDripDylan1 suggested, you dont need to use PlayerAdded or CharacterAdded in a local script, unless you want to run a function everytime another player joins.
You can simply do this:
local Player = game.Players.LocalPlayer
local CHAR = Player.Character or Player.CharacterAdded:Wait()
local HUM = CHAR:WaitForChild("Humanoid")