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

I am trying to make a script inside a TextButton that chooses your magic in an RPG game, (?)

Asked by 7 years ago

This script works but I'm just showing you that I already added it

game.Players.PlayerAdded:connect(function(player)
local M = instance.new("StringValue")
M.name = "Magic"
M.Value = "Nothing"
M.Parent = player.leaderstats

But this LocalScript doesn't work unfortunately

script.Parent.MouseButton1Click:Connect:function()
S = math.random(1,25)
if S = 1 then M.Value = "Phoenix"
if S = 2 then M.Value = "Void"
if S = 3 then M.Value = "Galaxy"
if S = 4 then M.Value = "Blackhole"
if S = 5 then M.Value = "Crystal"
if S = 6 then M.Value = "Explosion"
if S = 7 then M.Value = "Wood"
if S = 8 then M.Value = "Gold"
if S = 9 then M.Value = "Star"
if S = 10 then M.Value = "Poison"
if S = 11 then M.Value = "Vortex"
if S = 12 then M.Value = "Hurricane"
if S = 13 then M.Value = "Stone"
if S = 14 then M.Value = "Time"
if S = 15 then M.Value = "Amaterasu"
if S = 16 then M.Value = "Dragon"
if S = 17 then M.Value = "Supersonic"
if S = 18 then M.Value = "Diamond"
if S = 19 then M.Value = "leviathan"
if S = 20 then M.Value = "Magma"
if S = 21 then M.Value = "Acid"
if S = 22 then M.Value = "Plasma"
if S = 23 then M.Value = "Storm"
if S = 24 then M.Value = "Sound"
if S = 25 then M.Value = "Speed"

3 answers

Log in to vote
0
Answered by
phxtn 154
7 years ago

Firstly Change all the 'S =' into 'S =='

Secondly, after the word 'then' from line 3 to 27 make the value of M on the next line and put an end after it.

I dont know if I didnt explain it properly but Im sure you will understand.

If it works, plez give an upvote.

Ad
Log in to vote
0
Answered by
Smach28 10
7 years ago

So, First off, The 'S =' on lines 3-15 should be 'S ==' that is because '=' is only for locals when '==' is if you're changing the value of a local or doing an if. Second, 'M.Value' needs to be a 'Value.M'. Hope I helped.

0
incorrect, M.Value is right. also, "=" isn't necessarily for variables, it's generally for assigning a value creeperhunter76 554 — 7y
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
script.Parent.MouseButton1Click:Connect(function() -- put a parenthesis before the "function
S = math.random(1,25)
if S == 1 then 
    M.Value = "Phoenix"
elseif S == 2 then 
    M.Value = "Void"
elseif S == 3 then
    M.Value = "Galaxy"
elseif S == 4 then 
    M.Value = "Blackhole"
elseif S == 5 then 
    M.Value = "Crystal"
elseif S == 6 then 
    M.Value = "Explosion"
elseif S == 7 then 
    M.Value = "Wood"
elseif S == 8 then 
    M.Value = "Gold"
elseif S == 9 then 
    M.Value = "Star"
elseif S == 10 then 
    M.Value = "Poison"
elseif S == 11 then 
    M.Value = "Vortex"
elseif S == 12 then 
    M.Value = "Hurricane"
elseif S == 13 then 
    M.Value = "Stone"
elseif S == 14 then 
    M.Value = "Time"
elseif S == 15 then 
    M.Value = "Amaterasu"
elseif S == 16 then 
    M.Value = "Dragon"
elseif S == 17 then 
    M.Value = "Supersonic"
elseif S == 18 then 
    M.Value = "Diamond"
elseif S == 19 then 
    M.Value = "leviathan"
elseif S == 20 then 
    M.Value = "Magma"
elseif S == 21 then 
    M.Value = "Acid"
elseif S == 22 then 
    M.Value = "Plasma"
elseif S == 23 then 
    M.Value = "Storm"
elseif S == 24 then
    M.Value = "Sound"
elseif S == 25 then
    M.Value = "Speed"
end -- don't forget to end your statements
end)
0
And the end to end the function? where is that? hiimgoodpack 2009 — 7y

Answer this question