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

Instance.new stops working when inserting a table, and make a value = to the new instance?

Asked by 5 years ago
Edited 5 years ago

For some reason my script breaks, nothing in it works, and the new bool value i added to the player stops working, when there is a table with a value that is = to the instance.new that inserted the boolvalue into the player.

Here is what i did

game.Players.PlayerAdded:Connect(function(players)
 local save_values = {
["haschar"] = players:WaitForChild("Has_Char")
}
song:Play()
song.Looped = true
local has_char = Instance.new("BoolValue", players)
has_char.Name = "Has_Char"
players.CharacterAdded:Connect(function(character)
      end)
 end)

I dont understand why this wont work? it looks like it should to me. Any help would be appreciated. Thanks

0
'Players' was never defined, and you'd need to target the local player too. Ziffixture 6913 — 5y
0
Side Note: The 'CharacterAdded' method is redundant according to it having an empty scope. Ziffixture 6913 — 5y
0
Thats what it does, players is the local player, and is also = to game.Players.LocalPlayer basically but on server JuuzouBlitz 75 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Check if it is in a local script, as the code looks fine. But parenting something in the instance.new line is deprecated, so define it as a boolvalue then parent it on a seperate line.

Ad

Answer this question