So what I have is I want to change a boolvalue in a player, I've made a script to put value in the player and this is that script.
game.Players.PlayerAdded:Connect(function(player)
local boolValue = Instance.new("BoolValue", player)
boolValue.Name = "InPod"
boolValue.Value = false
end)
Then of course it appears in the player but I cant for the life of it change the value I have this script but I can't get it to work!
function onTouched(part)
local v = part.Parent:findFirstChild("InPod")
if v ~= false then v.Value = true end
end
script.Parent.Touched:connect(onTouched)
Also I'm pretty new to scripting and this is my first proper game so please put into detail thanks :).
EDIT: I thought I forgot something when the value is true it should not teleport the player to another game which I need and when the value is false, it should teleport the player to a different game, also heres what I have thanks to help by botw_legend I have this.
script.Parent.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
local bool = part.Parent.InPod
bool.Value = true
end
end)
game.Players.PlayerAdded:Connect(function(plr)
local char = game.Workspace:WaitForChild(plr.Name)
local bool = Instance.new("BoolValue",char)
bool.Name = "InPod"
bool.Value = false
end)

9 comments
i commented on ur question v down there just letting u know cause you don't get a notification if i comment on my question
ok i updated my answer tell me if it doesn't work
ok i updated my answer tell me if it doesn't work
i updated my answer can u tell me if it doesn't work?
i added a comment
i added a comment
ok changed my answer
i added a comment
ahh ok i made a change to my code i think i fixed it for good this time, hope it works!