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

Can't access value in local player?

Asked by 8 years ago

I have the value named "Participate". The output reads: "Participate is not a valid member of Player" Why is this?

Also do not simplify this. I usually work with a less efficient script so I can read it a little easier. I'll update it once everything works.

local Yes = script.Parent.Yes
local No = script.Parent.No
local Timer = script.Parent.Timer
local Info = script.Parent.Info

function Participating()
    Yes.Visible = false
    No.Visible = false
    game.Players.LocalPlayer.Participate.Value = 1
end
Yes.MouseButton1Down:connect(Participating)

function Participating()
    Yes.Visible = false
    No.Visible = false
    game.Players.LocalPlayer.Participate.Value = 0
end
No.MouseButton1Down:connect(Participating)

if game.Players.LocalPlayer.Parent == game.Players then
wait(1)
print("Found Player!")
while true do
    wait(0.05)
    if game.Players.LocalPlayer.Participate.Value == 0
        then Info.Text = "You are spectating the next race." elseif 
            game.Players.LocalPlayer.Participate.Value == 1 then
            Info.Text = "You are participating in the next race!"
    end
end
end
1
Make sure you're actually making the instance or cloning the instance into the player. Try adding "local variable = Instance.new("NumberValue",game.Players.LocalPlayer) variable.Name = "Participate"" at the top of your script. TheHospitalDev 1134 — 8y
0
I just realized a had a "StringValue" instead of a "NumberValue", thanks! Tradesmark 65 — 8y

Answer this question