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

How to move a script into a different model/category with a script?

So, I'm trying to make a door that only works once you get a key, And I'm trying to make it so whenever you grab the key, it automatically moves the script into the door so you can click to open it. It didn't work though

script.Keyholescript:Clone().Parent=game.Workspace.Keyhole.ClickDetector

Any advice? Thanks

1 answer

local cloned = script.Keyholescript:Clone()
cloned.Parent = game.Workspace.Keyhole.ClickDetector

You could just have a script inside the door all of the time which checks the players backpack for the key though, rather than cloning the script. Your call though. Hope this helped.

4 comments

0

Sadly its not a tool, its a model that dissapears when u press it

0

just keep the script in the door, then disable it. whenever the player gets the card, enable it.

0

Tried that, It enabled it when I got the key, but the script didnt work. But if i started with it enabled, it would work just fine.

0

and i tried to change the parent property via script and it just doesnt work, it puts it in the clickdetector but doesnt execute

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