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

Why wont this work? heres the error: 14:45:37.579 - RebirthCost is not a valid member of Player

This function is not working, im trying to make text update instantly but it cant find the player. Also if i run the game, look in the players part of the explorer and find my user name and open that up there is a value that is called RebirthCost that is attached to the player

game.Players.LocalPlayer.RebirthCost.Changed:Connect(function()
	script.Parent.Cost_Multiplier.Text = "Cost: $" .. game.Players.LocalPlayer.Cost.Value .. ", Multiplier: x" .. game.Players.LocalPlayer.Rebirths.Value + 1 * 2
end)

2 answers

create the var in a regular script

game.Players.PlayerAdded:Connect(function(plr)
	local Value = Instance.new("IntValue")
	Value.Name = "RebirthCost"
	Value.Parent = plr.Character
	Value.Value = 100
end)

We found the answer in the chat, he had to use WaitForChild in case it hasn't loaded yet

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