So... I may be thinking this a little bit too hard.
1 | local f = script.Parent.Spawner.Value |
2 |
3 | workspace.f.Part:Destroy() |
The part isn't getting destroyed.
You don't need workspace, only f
. f
is a reference to the object already.
1 | f.Part:Destroy() -- This doesn't look right if it's an actual value, but I can't see your Workspace so I will assume it is correct. |
Variable Link: http://robloxdev.com/articles/Variables
Examples:
local variableA = game.Workspace.Part
local variableB = 5
local variableC = "String"
local variableD = CFrame.new()
local variableE = Color3.new()
Ect...
If you're gonna index the value of variable 'f', use square parenthesis:
1 | workspace [ f ] .Part:Destroy() |
First, it would be
1 | game.Workspace.f.Part:Destroy() |
Second, what you have here is implying that inside the scripts parent there is a spawner with a value inside of it, and inside the value is a part.
Try this for the overall
1 | local f = script.Parent -- assuming the parent of the script is what you want destroyed |
2 | wait( 0 ) |
3 | game.Workspace.f:Destroy() |