No, Scripts cannot access the LocalPlayer unless you use RemoteEvents
Yes, but tool.Parent can be referenced which is basically the character as when tools are equipped they go in the model for the character.
local rbg = script.Parent.RightBoxingGlove
local lbg = script.Parent.LeftBoxingGlove
local tool = script.Parent
local Char = tool.Parent
tool.Equipped:Connect(function()
local rweld = Instance.new("Weld")
rweld.Part0 = Char.RightHand
rweld.Part1 = rbg
rbg.Position = Char.RightHand.Position
local lweld = Instance.new("Weld")
lweld.Part0 = Char.LeftHand
lweld.Part1 = lbg
lbg.Position = Char.LeftHand.Position
end)
the boxing gloves go on the dummy
Do you get any errors in output?
no there is no errors I dont know why
Hey, detect the player equipping the boxing gloves and use RemoteEvents to pass the player and then get the character from it.
Iâm going to test the script myself and see whatâs going on. Btw, make sure that the boxing gloves arenât anchored.
I am not experienced with scripting I am not sure how to do that
The way that you recommended to do is not the most optimal and I HIGHLY recommend not to do so.
i updated the post and put the image on
As I said, please do try this method
Detect the player equipping the boxing gloves and use RemoteEvents to pass the player and then get the character from it.
i am not experienced with scripting I am not sure how to do that
One quick question, is the parent of the tool Players?
it is a tool
I see the issue, you donât have a handle. Hold on.
Go into the properties of the tool, and uncheck RequiresHandle.
the error is âRightHand is not a valid member of Backpackâ
@Official_ProGamerYT Here is an example script on how to do it
(This script is inside the tool and is a LocalScript. Also add a RemoteEvent inside ReplicatedStorage)
local tool = script.Parent
local equipEvent = game.ReplicatedStorage:WaitForChild("REMOTENAMEHERE")
tool.Equipped:Connect(function()
equipEvent:FireServer(tool) -- Fires a remoteEvent when a player equips the tool and passes the tool as an argument
end)
This is a script in ServerScriptService
local equipEvent = game.ReplicatedStorage:WaitForChild("REMOTENAMEHERE")
equipEvent.OnServerEvent:Connect(function(player,tool) -- detecting the Fired RemoteEvent
if tool:IsDescendantOf(game.Workspace) then
local rbg = tool.RightBoxingGlove
local lbg = tool.LeftBoxingGlove
local Char = player.Character or player.CharacterAdded:Wait()
local rweld = Instance.new("Weld")
rweld.Part0 = Char.RightHand
rweld.Part1 = rbg
rbg.Position = Char.RightHand.Position
rbg.Parent = Char.RightHand
local lweld = Instance.new("Weld")
lweld.Part0 = Char.LeftHand
lweld.Part1 = lbg
lbg.Position = Char.LeftHand.Position
lbg.Parent = Char.LeftHand
end
end)
local rbg = script.Parent.RightBoxingGlove
local lbg = script.Parent.LeftBoxingGlove
local tool = script.Parent
tool.Equipped:Connect(function()
local Char = tool.Parent
Char.HumanoidRootPart.Anchored = true
--Welding Parts
local rweld = Instance.new("WeldConstraint")
rweld.Part0 = Char.RightHand
rweld.Part1 = rbg
rbg.Position = Char.RightHand.Position
rbg.Parent = Char.RightHand
local lweld = Instance.new("WeldConstraint")
lweld.Part0 = Char.LeftHand
lweld.Part1 = lbg
lbg.Position = Char.LeftHand.Position
lbg.Parent = Char.LeftHand
wait(1)
--Finished, unanchor the player.
Char.HumanoidRootPart.Anchored = false
end)
it still says âRightHand is not a valid member of Backpackâ