hello everyone here again asking for help,
this time I want to make: a script that when you click while you have a tool equipped, it equips you with an accessory.
there is this script the accessory is called MetalArmorChes.
the problem is that when I click with the equipped tool, I don’t get any accessories
What’s The Parent of The Tool?
doesnt have
What do you mean exactly
What’s The Instance / Object That You Added “Mouse1Button” Event?
clicking with the toolset.
It should be activated when you click with the tool in your hand
Well, Sorry for The Late Replay, Also Here’s The Steps To Solve This Problem
Explorer:
The Part That Inside The Tool Must Be Called “Handle” If It’s Called Something Else It Won’t Work.
Local Script:
script.Parent.Equipped:Connect(function()
local Mouse = game.Players.LocalPlayer:GetMouse()
Mouse.Button1Down:Connect(function()
-- Code, Here What You Want To Do
end)
end)
Also Please if This is The Solve, Give me The Solution To Let The People Knows That Your problem Is Already Solved.
Thanks,
Mezo.
Im on that, wait a few seconds
Alright, Fine.
( Character Limit )
ServerStorage instances aren’t replicated to the client. Put the armor in ReplicatedStorage
oh… lol ty i will try that
well it still didnt work
Is there a reason you need to use the mouse instead of Tool.Activated? I think it’d work better for this.
yes i was going to say it thanks for correcting it
Also You Can Put An RemoteEvent In Replicated Stroage And Do That:
LocalScript:
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
game.Players.PlayerAdded:Connect(function(Player)
local h = Player.Character.Humanoid
script.Parent.Equipped:Connect(function()
local Mouse = game.Players.LocalPlayer:GetMouse()
Mouse.Button1Down:Connect(function()
RemoteEvent:FireServer(Player)
end)
end)
end)
Server Script:
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
RemoteEvent.OnServerEvent:Connect(function(Player)
local MetalArmorChe = game.ServerStorage.Armor.MetalArmorChe
MetalArmorChe:Clone().Parent = Player.Character
end)
There’s actually no need for any of that. Tool.Activated can run server-side too.
--Put this code in a normal script inside the tool
local ServerStorage = game:GetService("ServerStorage");
local armor = ServerStorage.Armor;
local tool = script.Parent;
tool.Activated:Connect(function() --Fires when the tool is used
local char = tool.Parent; --This is the character
local metalArmor = armor.MetalArmorChe:Clone(); --Clones the armor
metalArmor.Parent = char; --Puts it in the character
end)
ah yes sorry im idiot lol
( Character Limit )
If I thought that, the remote event is for very complex or very exact things, among others, I think
Use RemoteEvents when you’re sending over client-exclusive data to the server, like the mouse for example. In this situation, you don’t need a RemoteEvent.
heck it didn’t work either …
or wait it should not be put in local script if it works Tysm!!!