Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to i get this to work in a public server(this is in a localscript)?

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)

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.