Trying to make a simple game to test my coding abilities, and I've stumbled upon this problem. How would I grab the character whenever they click a TextButton inside a GUI? I don't know if this will help, but here is my code.
local button = script.Parent
local character = game.Players:GetPlayerFromCharacter(character)
button.MouseButton1Click:Connect(function()
if game.Workspace.Sound.Playing ~= true then
character.Humanoid.WalkSpeed = 90
game.Workspace.Sound.Playing = true
game.Workspace.Sound.Looped = true
else
character.Humanoid.WalkSpeed = 16
game.Workspace.Sound.Playing = false
game.Workspace.Sound.Looped = false
end
end)
I removed a couple of things so right now it isn't finished.

4 comments
Thanks so much!
Just tried this, and it returned this error:Players. Just_Moop.PlayerGui.Run.Frame.TextButton.Script:3: attempt to index local 'client' (a nil value)
Sounds like your script isn't local.
Oh i need to make a local? Whoops sorry.