Sorry im super new with scripting help please?
local Workspace = game:GetService("Workspace")
Workspace:FindFirstChild("SoundRegions")
script.Parent.MoveTo("SoundRegions") -- this is the part where I want the parent to move to soundregions
Sorry im super new with scripting help please?
local Workspace = game:GetService("Workspace")
Workspace:FindFirstChild("SoundRegions")
script.Parent.MoveTo("SoundRegions") -- this is the part where I want the parent to move to soundregions
There are some problems with that.
1.) You are using the MoveTo function incorrectly, as it is only for models.
2.) You did not set SoundRegions as a variable so the script does not know what ("SoundRegions") is.
Also, you do not have to declare Workspace as a variable, as there is already a variable called workspace built into Roblox Lua.
Try this code:
local soundRegions = workspace:WaitForChild("SoundRegions") -- I use WaitForChild since it yeilds the script until it loads in
script.Parent.Parent = soundRegions -- Sets the script's parent to soundRegions
Hi, few things.
Workspace:FindFirstChild("SoundRegions")
you forgot to give it a variable, like so:
soundregions = Workspace:FindFirstChild("SoundRegions")
script.Parent = soundregions
so to fix up your script completely for you
local soundregions = workspace:FindFirstChild("SoundRegions")
script.Parent = soundregions
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
For some reason the script send the itself to sound regions
I would have excepted your answer but it was script.Parent.Parent