I'm trying to make a script where when a player joins, they get a random power. My idea on how to do this is if a random value is a certain number, then that is the power they get (Ex: (Power).Value = 45). The issue is, I can't do if statements because it makes the equal sign invalid. I can't do while true do statements either, as it just causes it to turn into the value. I'm bad with wording, so here is a script if it helps.
game.Players.PlayerAdded:Connect(function(player)
local Powers = Instance.new("Folder")
Powers.Name = "Powers"
Powers.Parent = player
local Earth = Instance.new("NumberValue")
Earth.Name = "Earth"
Earth.Parent = Powers
local Fire = Instance.new("NumberValue")
Fire.Name = "Fire"
Fire.Parent = Powers
local Electricity = Instance.new("NumberValue")
Electricity.Name = "Electricity"
Electricity.Parent = Powers
local PowerTable = {}
PowerTable[1] = Electricity
PowerTable[2] = Earth
PowerTable[3] = Fire
PowerTable[math.random(1,3)].Value = 45
Fire.Value = 45 while true do
game.StarterPlayer.StarterPlayerScripts.SkillActivation1.Disabled = true
game.StarterPlayer.StarterPlayerScripts.SkillActivation3.Disabled = true
game.StarterPlayer.StarterPlayerScripts.SkillActivation4.Disabled = true
end
Electricity.Value = 0 while true do
game.StarterPlayer.StarterPlayerScripts.SkillActivation.Disabled = true
game.StarterPlayer.StarterPlayerScripts.SkillActivation3.Disabled = true
game.StarterPlayer.StarterPlayerScripts.SkillActivation4.Disabled = true
end
Earth.Value = 45 while true do
game.StarterPlayer.StarterPlayerScripts.SkillActivation1.Disabled = true
game.StarterPlayer.StarterPlayerScripts.SkillActivation.Disabled = true
game.StarterPlayer.StarterPlayerScripts.SkillActivation3.Disabled = true
end
end)

2 comments
ah! Thanks. I should probably look into it more. I've been wondering what the use of == was.
Glad I could help :D