local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() --don't mind this script.Parent.Parent.Visible = false end) --dont mind this function parentPressed() game.ReplicatedStorage.SMG:Clone(function(). --this function aint working game.ReplicatedStorage.SMG.Parent = player.backpack end) end script.Parent.MouseButton1Down:connect(parentPressed)
This aint working please help
use remote events
-- local script
script.Parent.MouseButton1Click:Connect(function() RemoteEvent:FireServer() end)
-- ServerScript
RemoteEvent.OnServerEvent:Connect(function(plr) local SMG = game.ReplicatedStorage.SMG:Clone() SMG.Parent = plr.Backpack end)
--[[ Cloning something with a local script wont work very well. I have never made clone into a function so idk how that works but you could use the part that I made below (only errors that I saw were the . after the function() and player.backpack the backpack needs to be capicalized) ]] game.ReplicatedStorage.SMG:Clone().Parent = player.Backpack