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

Tool only visible to person equipping it?

Asked by 5 years ago

I have to assume it's a local script thing, but basically it is a localscript inside of a tool that duplicates and welds a gun model to the players hand when the tool is equipped. Only issue is other players cannot see the gun, and the animations will not play when actually playing the game. How do I fix this?

0
The Animations are likely not Playing because you don’t own them. Ziffixture 6913 — 5y
0
1. It's local meaning other people can't see it. 2. You don't own the animations therefore they cannot play. NewGPU 36 — 5y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

Problem


FE, as all Scripts know, tells the Server to deny replication to other Clients of actions caused by the LocalClient. Since you’ve welded a Part to your Character locally, only you will be effected by this. Resulting in this measure, this would not have “happened” on the Server.


Solution


Simply, you will have to let the Server preform this action. This can be done using RemoteEvents, if not familiar already.

The application would look like so:

--// LocalScript - Preferably a Child of Tool
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

local Tool = script:FindFirstAncestorWhichIsA("Tool")

Tool.Equipped:Connect(function()
   RemoteEvent:FireServer(Tool.Handle) --// assuming the Handle is the buildup of your Tool.
end)

--// ServerScript - Preferably a Child of ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

RemoteEvent.OnServerEvent:Connect(function(ToolHolder, Handle)
   --// 'ToolHolder' and 'Handle' should be what you need to accomplish your weld.
end)

Hope this helps! If there’s anything you’d like me to clarify, please comment! Don’t forget to accept!

Ad

Answer this question