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

How do I move a tool into a player's model?

Asked by 9 years ago

I know I can manually put a tool into my Player's Model and the player will equip it, but how can I put the tool into the Player's Model on the click of a button?

0
I've edited my answer. Shawnyg 4330 — 9y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

Well, since you haven't attempted to script this, or at least haven't shown it, I'll just give you some pointers and an empty script. If it's a physical button, you'd need to insert a ClickDetector into the part. To detect when it's clicked, you'd need to use the MouseClick event. Here's a script you'll have to fill in:

tool = game.ServerStorage.Tool

script.Parent.ClickDetector. -- fill in the rest here, for the MouseClick event!
    tool:clone().Parent = -- fill it in!
end)

The Wiki does have a sample script, as well as an explanation here

If it's a GUI Button, you'd need to use the MouseButton1Click event or the MouseButton1Down event. It's sort of the same concept as a physical button, except you can make it a local script!

script.Parent.MouseButton1Click:connect(function()
    game.Lighting.Tool:clone().Parent = game.Players.LocalPlayer.Character
end)
0
It's not a physical button, so I'll go and put it in my Screengui Button instead. TheFlamingBlaster 5 — 9y
0
Ah, Let me edit my answer. Shawnyg 4330 — 9y
Ad

Answer this question