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

Getting name from gui click?

Asked by
NotSoNorm 777 Moderation Voter
9 years ago

Alrighty, how would I get the players name, add a "sVelociraptor" to the end of their name and use it in a path?

function Down()
    local clicker = script.Parent.Parent.Parent.Name.."sVelociraptor"
game.Workspace.clicker.Head.Call:Play()
end
script.Parent.MouseButton1Click:connect(Down)

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

You should be using a localscript anyways so use game.Players.LocalPlayer and index the Name Property.

local plr = game.Players.LocalPlayer

function Down()
    local clicker = plr.Name.."'s Velociraptor"
    workspace.clicker.Head.Call:Play()
end

script.Parent.MouseButton1Click:connect(Down)
Ad

Answer this question