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

the script worked correctly till i added that if statment so what happened ?

its a server-sided script in the serverscriptservice. it should create a boolvlaue inside the player and it worked

plr = game.Players:GetPlayerFromCharacter(player)
game.Players.PlayerAdded:Connect(function(player)
local vip = Instance.new("BoolValue")
 vip.Parent = player
 vip.Name = "vip"
end)

but when i added the if statment it didn't work and there is no errors in the output..

plr = game.Players:GetPlayerFromCharacter(player)
game.Players.PlayerAdded:Connect(function(player)
if player.Name == hmurban then
local vip = Instance.new("BoolValue")
 vip.Parent = player
 vip.Name = "vip"
end
end)

1 comment

0

What is player defined as on line 1?

1 answer

✓ Accepted answer

hmurban would be a variable, and you might want to do it like

hmurban = "hmurban"
plr = game.Players:GetPlayerFromCharacter(player)
game.Players.PlayerAdded:Connect(function(player)
if player.Name == hmurban then
local vip = Instance.new("BoolValue")
 vip.Parent = player
 vip.Name = "vip"
end
end)

Your code should be: which is shorter

plr = game.Players:GetPlayerFromCharacter(player)
game.Players.PlayerAdded:Connect(function(player)
if player.Name == "hmurban" then
local vip = Instance.new("BoolValue")
 vip.Parent = player
 vip.Name = "vip"
end
end)

1 comment

1

thanks that worked ^^

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