[All I want to know is what would I put in the parameters for the :GetPlayerFromCharacter(), or what could I do to get the player]
Code(it is in a TextButton that is inside a Gui that is inside StarterGui):
function onClicked() local p = game.Players:GetPlayerFromCharacter() local t = script.Parent.Parent.Parent.Parent.Character.Torso if p.TeamColor == "Bright bluish green" then t.CFrame = game.Workspace.MiningTycoon.Tycoons.Diamond.Essentials.Spawn.CFrame elseif p.TeamColor == "Really red" then t.CFrame = game.Workspace.MiningTycoon.Tycoons.Ruby.Essentials.Spawn.CFrame end end script.Parent.MouseButton1Down:connect(onClicked)
Well, you don't need to use :GetPlayerFromCharacter(), because this is in the player all ready, you could just do:
local player = script.Parent.Parent.Parent.Parent--This would work if the TextButton's parent was a screen GUi in the StarterGui
But to use the GetPlayerFromCharacter, you still need the player, eg
local player = script.Parent.Parent.Parent.Parent function onClicked() local p = game.Players:GetPlayerFromCharacter(player.Character) local t = script.Parent.Parent.Parent.Parent.Character.Torso if p.TeamColor == "Bright bluish green" then t.CFrame = game.Workspace.MiningTycoon.Tycoons.Diamond.Essentials.Spawn.CFrame elseif p.TeamColor == "Really red" then t.CFrame = game.Workspace.MiningTycoon.Tycoons.Ruby.Essentials.Spawn.CFrame end end script.Parent.MouseButton1Down:connect(onClicked)
If this helps, why don't you click that accept answer button? It gives us both rep!!
To use :GetPlayerFromCharacter(), the parameter is for the Character. Now, with a GUI you wouldn't really have a good reason to use it, at least, not with what you're doing. You should always use a localscript for GUI's which to get the player for a LocalScript, all you need to do is local Variable = game.Players.LocalPlayer
and now you have the Player.
Now, I will show you a quick script that will print the Players name when a player touches it, getting the player with GetPlayerFromCharacter() as an example for later use.
script.Parent.Touched:connect(function(hit) -- assuming script is in the part local Char = hit.Parent -- the model containing the players part is considered the Player, AKA Figure. local Plr = game.Players:GetPlayerFromCharacter(Char) print(Plr.Name.." has touched this part") end)