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

How do I make this RemoteEvent give a tool from the serverstorage?

I'm trying to give the player a tool from serverstorage when they click the button, and it's not giving it to me. This is the code I wrote:

local event = script.Parent.GiveItem local Misc = game.ServerStorage.Assets.Misc local item = script.Parent.Joint.Item.Value

event.OnServerEvent:Connect(function(player) Misc.item:Clone().Parent = player.Backpack end)

The event handler script is a normal script inside the gui. And the RemoteEvent is also inside the gui.

4 comments

0

pls use code blocks

0

did you fire the server?

0

I pretty sure it is meant to be ReplicatedStorage not server storage, I had once the same question.

0

no if its in replicated storage that means it can be exploited, you are right to place it in server storage

1 answer

local event = script.Parent.GiveItem
local Misc = game.ServerStorage.Assets.Misc
local item = script.Parent.Joint.Item.Value

event.OnServerEvent:Connect(function(player)
Misc[item]:Clone().Parent =player.Backpack--if you want to give the item that you made a variable then you need these brackets [] to indicate to the script that you want the item with that string as a name
end)

1 comment

0

btw, this will only work if Value in the item variable really is a string

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