I'm trying to change a value inside of a player? (The script is isnide of a GUI)
Script :
function onClicked(Player)
Player:FindFirstChild("Class").Value = Player:FindFirstChild("Class").Value = "Knight"
end
Dosen't work...
I'm trying to change a value inside of a player? (The script is isnide of a GUI)
Script :
function onClicked(Player)
Player:FindFirstChild("Class").Value = Player:FindFirstChild("Class").Value = "Knight"
end
Dosen't work...
The function has nothing to call it, nor is it being called.
Use this:
-- Assuming this script is in a GUI button.
function onClicked(Player)
Player:FindFirstChild("Class").Value = Player:FindFirstChild("Class").Value = "Knight"
end
script.Parent.MouseButton1Click:connect(onClicked)
I recommend using variables, using "local"
This MIGHT work:
function onClicked(Player)
local class = Player:FindFirstChild("Class")
class.Value = "Knight"
end
script.Parent.MouseButton1Click:connect(onClicked)
But, you didn't declare what "Player" is. I recommend the following, but use a LocalScript:
function onClicked(Player)
local Player = game.Players.LocalPlayer
local class = Player:FindFirstChild("Class")
class.Value = "Knight"
end
script.Parent.MouseButton1Click:connect(onClicked)
Please comment if you have questions!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Omg, i always forget to do that lmao, thanks