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

Keycard that's given by GUI coming from Replicated storage doesn't work?

Hello reader! Basically I am making a hotel game, and I have made a keycard giver, and it gives me the keycard, and everything goes well, until I try to use the keycard on the door. It's like if the scripts were disabled, as it doesn't even print anything.

The keycard comes from the replicated storage folder, and is given through a Gui.

local tool = game.ReplicatedStorage["001"] local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function() tool:Clone() --clones tool tool:Clone().Parent = player.Backpack end)

I need it to some how clone the tool and put it into the backpack without the scripts breaking.

Any help is appreciated! If you have any questions, you may ask!

Thanks in Advance, Spxnkles

2 comments

0

Could you maybe post the script for the door instead? All this script does is give the keycard and as you said, it works fine.

0

Try putting the tool in StarterPack and test if it works. And let me know if the tool works fine or not.

2 answers

The reason your keycard isn't working is because it's client-side only. You cloned the keycard on the client and parented it on the client; the server does not see any of this happening. Therefore, any scripts that would be server-side located in the keycard do not function properly. The solution to your problem is to give the keycard to the player from the server, not from the client.

4 comments

0

Thanks for the response! Do you have any idea how to do this? I tried switching the local script to a script, but it didn't work. Any idea how to make it so it gives the keycard from the server?

0

You need an alternative for getting the player. You can use a RemoteEvent to get that player.

0

Ok, and are there any tutorials anywhere on how to do it? I am more of a builder then a scripter, so sorry for me being so bad at it.

Thank you everyone for your help! I managed to make it work trough remote events!

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