Hey, so I have this tool that shoots balls when clicked, I made it so that I have 10 tools each the same but with more damage and a different color, I put this tool in the starter GUI and I made it so that when you press a button you would get the weapon:
UPGRADEB.MouseButton1Down:Connect(function()
if LVL.Value == 0 then
if COINS.Value >= 500 then
local tool = script.Parent.WHITE:Clone()
tool.Parent = p.Backpack
LVL.Value = 1
COINS = COINS - 500
end
end
end)
This works but when I play with others they cannot see the tool and when I kill them with it on their screen they are still alive.
How do I fix this?
2 Likes
LocalScripts can only change something for the client that it is running on so you have to use a Script to add the tool to the players Backpack.
-
Create a folder in ServerStorage for the tools named “Tools”
-
Put the tools in that folder
-
Insert a RemoteEvent in ReplicatedStorage named “ToolEvent”
-
Create a script in ServerScriptService
local ToolFolder = game:GetService("ServerStorage").Tools
local WhiteToolEvent = game:GetService("ReplicatedStorage").WhiteToolEvent
--create 2 variables for the level and coins values here
WhiteToolEvent.OnServerEvent:Connect(function(player)
--Change coins and level values here
local cloneTool = ToolFolder.WHITE:Clone()
cloneTool.Parent = player.Backpack
end)
Your existing script
local WhiteToolEvent = game:GetService("ReplicatedStorage").WhiteToolEvent
UPGRADER.MouseButton1Click:Connect(function()
if LVL.Value == 0 then
if COINS.Value >= 500 then
WhiteToolEvent:FireServer()
end
end
end)
Now the tools should be visible to other players. The problem was that LocalScripts can only change something for the client and not the server so it had the tool in your Backpack on your client but the server can’t see those changes so the it did not replicate it to the other clients.
Hey,thanks for the answer,I tried doing what you said to do and others where successfully able to see the tools I was holding but the tool am using(Its a free asset that I modified) works by shooting a sphere at the player and when it hits them they lose damage,however whenever I hit a player they loose health in my screen but not on theirs and when I kill them they die on my screen but not theirs,do you know how to fix this?
1 Like
Do the kill code on the server side with the same remote event.
Also, try to re-create the tool yourself if you can.
2 Likes
Thanks, ill try that right now.
Could you format that a bit better?
1 Like
I deleted the post since its probably too much to ask for you to help,Ill try to make my own tool so its easier for me to figure out what to do.
It’s okay, but I have a question. When you shoot the sphere, does it drop, or go straight?
Also send me a video of the tool in action so I could help
1 Like
It goes straight.
It also changes sizes depending on how long you hold the sphere,Ill make a video right now.
I’ll have to request access (30 chars)
1 Like
I get the idea but it is hard to see exactly what is happening. Is this place published? If so, can you give me the link? (I’m sorry if I’m asking too much.)
1 Like
https://www.roblox.com/games/5299011757/IQ-SIMULATOR-ALPHA
Sorry took long I had to fix some bugs,press b if you want instant money
Thank you so much!
Take as much time as you need 
I’m sorry I haven’t got to you in a while. I’ll try and do it today. Sorry!
Hey sorry,I already payed someone to fix it for me thanks for the help though!
See, this is why I hate my memory so much. I literally was just about to start until I saw this.
1 Like