What do you want to achieve? Having trouble making 2 values in a player model with a script.
What is the issue? I can’t put more than one value in a player with a script.
What solutions have you tried so far? Tried making them in different scripts.
player.CharacterAdded:Connect(function(char)
repeat wait()until char.Head
local newValue = Instance.new("BoolValue", char)
newValue.Name = "HandcuffValue"
newValue.Value = false
local grabValue = Instance.new("BoolValue", char)
grabValue.Name = "GrabValue"
grabValue.Value = false
char.Parent = game.Workspace:WaitForChild("Players")
end)
end)
TheDCraft
(TheDCraft)
March 17, 2021, 6:36pm
#2
See what your doing here is you are parenting the player to itself. So what you would need to do is.
newValue.Parent = char
--
GrabValue.Parent = char
Edit: I just realised you parented it already. You should get rid of the repeat at the start since it’s pointless.
1 Like
You could use attributes plus it takes way less memory.
1 Like
TheDCraft
(TheDCraft)
March 17, 2021, 6:52pm
#5
Yeah, I do recommend what @reetsinha2006 said, Attributes are really good at keeping clean and simple. They require less lines of code to create as well.
There’s no need to be using a repeat wait()
loop for waiting for a Head
to arrive, use WaitForChild()
instead
Also as other people have mentioned you parented the Values to the Character lol
player.CharacterAdded:Connect(function(char)
local Head = char:WaitForChild("Head")
local newValue = Instance.new("BoolValue")
newValue.Name = "HandcuffValue"
newValue.Value = false
newvalue.Parent = Head
local grabValue = Instance.new("BoolValue")
grabValue.Name = "GrabValue"
grabValue.Value = false
grabValue.Parent = head
char.Parent = game.Workspace:WaitForChild("Players")
end)
end)
Also please refrain from using the second parameter for the Instance.new()
function