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

Item in Filtering Enabled not cloning when a GUI button is pressed?

I am trying to make it so that when you press a button, you get a tool put in your backpack. I'm really new to programming with FE on, so I don't know what the problem is with this code:

Script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "GiveTool"
 
local function give(player, obj)
	a = obj:Clone()
	a.Parent = player.Backpack
end
 
createPartEvent.OnServerEvent:Connect(give)

LocalScript

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = ReplicatedStorage:WaitForChild("GiveTool")

script.Parent.MouseButton1Down:connect(function()
	
	createPartEvent:FireServer(game.Players.LocalPlayer, script.Parent.Parent.obj.Value)
	
end)

Please help.

1 comment

0

bump

1 answer

The player is automatically sent to the server so no need to define it when sending. This is what is breaking your script.

createPartEvent:FireServer(script.Parent.Parent.obj.Value)

This discussion is preserved as it was. New answers, comments, and votes are closed.