local re = game:GetService("ReplicatedStorage")
local gun = re:WaitForChild("GunOne")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function()
local clonedgun = gun:Clone()
clonedgun.Parent = player.Backpack
end)
COMMUNITY QUESTION
How to i get this to work in a public server(this is in a localscript)?
1 answer
Since you are using a LocalScript, you should use your variable, "player" aswell as identify the player's mouse in order to trigger an event.
local re = game:GetService("ReplicatedStorage") local gun = re:WaitForChild("GunOne") local player = game.Players.LocalPlayer local m = player:GetMouse()
m.Button1Down:connect(function(m) local clonedgun = gun:Clone() clonedgun.Parent = player.Backpack end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
