Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
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.

0
Sadly its not a tool, its a model that dissapears when u press it BonkTonkDonk 7 — 4y
0
just keep the script in the door, then disable it. whenever the player gets the card, enable it. matiss112233 258 — 4y
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. BonkTonkDonk 7 — 4y
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 BonkTonkDonk 7 — 4y
Ad

Answer this question