Sorry im super new with scripting help please?
1 | local Workspace = game:GetService( "Workspace" ) |
2 |
3 | Workspace:FindFirstChild( "SoundRegions" ) |
4 | 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:
1 | local soundRegions = workspace:WaitForChild( "SoundRegions" ) -- I use WaitForChild since it yeilds the script until it loads in |
2 |
3 | script.Parent.Parent = soundRegions -- Sets the script's parent to soundRegions |
Hi, few things.
1 | Workspace:FindFirstChild( "SoundRegions" ) |
you forgot to give it a variable, like so:
1 | soundregions = Workspace:FindFirstChild( "SoundRegions" ) |
1 | script.Parent = soundregions |
so to fix up your script completely for you
1 | local soundregions = workspace:FindFirstChild( "SoundRegions" ) |
2 | script.Parent = soundregions |