So recently I was making this toolbox game so I can grab stuff I've made by myself so I don't just have to create it all over again. I have been making some tools in the collection, and I have some questions on the tool object.
If you can answer these questions, I would be so happy! Thanks.
You would call it by: a. Calling it in a localscript by game.Players.LocalPlayer. b. From a normal script, if it was in the players hand, you would do game.Players:FindFirstChild(tool.Parent.Name) or if it was just in their backpack: tool.Parent.Parent
The tool would move with the animation, staying on the hand.
(Please accept if this helped you!)
From a localscript you can get the player by saying:
player = game.Players.LocalPlayer
Get the character by saying:
player = game.Players.LocalPlayer repeat wait() until player.Character character = player.Character
From a normal script it's a bit different. There is no concept of a local player because the script runs on the server not the client. The server only knows it has a bunch of players in it.
You can get a player, but only through roblox's built in events or through remote events.
Never tried getting a player through remote events. Don't think you'd ever need to.
If you want to get a player when you're touching a brick for example, you'd do the following:
part = game.Workspace.Part part.Touched:Connect(function (hit) --see if the thing touching our part is a player local player = game.Players:FindFirstChild(hit.Parent.Name) --if it is a player get it's character and tool if(player)then local character = hit.Parent local tool = character:FindFirstChildWhichIsA("Tool") end end)
Yes, you can even play both animations at once if you'd like.