I honestly don't know why this isn't working, it works on my other game, exact same scripting, exact locations of all models and names, I just don't understand. Please someone help.
Error: Workspace.Part3.Script:10: attempt to index local 'Player' (a nil value)
local Players = game:GetService('Players')
local debounce = false
local Teleport = "Part4"
function onTouched(hit)
if debounce == false then
debounce = true
local OnTouchSky = game.ServerStorage.SkyChanger2
local OnTouchSkyCopy = OnTouchSky:Clone()
local Player = Players:FindFirstChild(hit.Parent.Name)
if Player.PlayerGui:FindFirstChild("SkyChanger") then
if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true
local Pos = script.Parent.Parent:findFirstChild(Teleport)
hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false
end
Player.PlayerGui.SkyChanger:Destroy()
OnTouchSkyCopy.Parent = Player.PlayerGui
debounce = false
else
if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true
local Pos = script.Parent.Parent:findFirstChild(Teleport)
hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false
end
OnTouchSkyCopy.Parent = Player.PlayerGui
debounce = false
end
end
end
script.Parent.Touched:Connect(onTouched)

7 comments
It's saying FindFirstChildHumanoid is not a valid member of model
Oops, I made a typo. Try again.
Made another typo actually, I forgot quotes around humanoid
should be good now
pls mark as answered / comment if it's not working when you see this
Thank you so much bro!
no thank u