Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does it say Player is not a valid member of workspace?

Asked by 6 years ago

Whenever I try this script in-game it says Player is not a valid member of workspace. It doesn't work in studio either. I tried changing the variable Player to Llayer, but it still doesn't work

local config = script.Parent.Configuration

script.Parent.Touched:connect(function(part) if part.Parent and game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then local Llayer = game:GetService('Players'):GetPlayerFromCharacter(part.Parent) if Llayer:GetRankInGroup(config.GroupId.Value) > config.RankId.Value then game.Workspace.Player.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-20.886, 5.01, 133.345)) end end end)

1 answer

Log in to vote
0
Answered by
Tomstah 401 Moderation Voter
6 years ago
Edited 6 years ago

Your code may be running too fast. http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild

Look into that method right there ^. What might be happening is your code runs so fast the play hasn't even spawned in. Therefore, it's not a member, yet.

Ad

Answer this question