Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

"XXXXX is not a valid member of Player" Error?

For the last line, I keep getting an error saying "Position is not a valid member of Player". I've done everything from changing the parent of Position, to placing the script in different places but nothing is working. Thank you in advance! Edit: (This is a local script in StarterGui)

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local char = player.Character
local torso = char:WaitForChild("Torso")


Pos = Instance.new("Folder",script.Parent.Parent)
Pos.Name = "Position"


XPos = Instance.new("IntValue",Pos)
XPos.Name = "XPos"

YPos = Instance.new("IntValue",Pos)
YPos.Name = "YPos"

ZPos = Instance.new("IntValue",Pos)
ZPos.Name = "ZPos"

--Keeps track of the player's torso position
while 1==1 do
    X = torso.Position.X
    Y = torso.Position.Y
    Z = torso.Position.Z
    wait()
    XPos.Value = X
    YPos.Value = Y
    ZPos.Value = Z
end



a = nil
function Jay()
	local X = script.Parent.Parent.Position.XPos.Value
	local Y = script.Parent.Parent.Position.YPos.Value
	local Z = script.Parent.Parent.Position.ZPos.Value

    if a == nil or a == true then   
        if X >= -5 and X <= 5 then
            if Y >= 2 and Y<= 10 then
                if Z >= 190 and Z <= 202 then
                    for i=1, 0.5, -0.1 do
                        script.Parent.Parent.PlayerGui.ScreenGui.PressFTo.TextTransparency = i
                        wait()
                    end
                    a = false
                    script.Parent.ScreenGui.chatFrame.FirstConversation.Disabled = false
                end
            end
        end
    end

    if a == false then
        if not(X >= -5 and X <= 5) or not(Z >= 190 and Z <= 202) then
            for i=0.5, 1, 0.1 do
                script.Parent.Parent.PlayerGui.ScreenGui.PressFTo.TextTransparency = i
                wait()
            end
            a = true
            script.Parent.ScreenGui.chatFrame.FirstConversation.Disabled = true
        end
    end
end

script.Parent.Parent.Position.XPos.Changed:connect(Jay)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.