ZacBytes
(Zachary)
December 9, 2017, 5:41am
#1
CODE:
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Text == "Enabled" then
print("Disabling Motion Blur")
script.Parent.Text = "Disabled"
script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.MotionBlur:Destroy()
elseif script.Parent.Text == "Disabled"
then
print("Enabling Motion Blur")
script.Parent.Text = "Enabled"
script.MotionBlur:Clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
end
end)
When I click the button, it prints but the Motion Blur script isn’t destroyed for some reason, thanks
1 Like
Is the game in experimental mode?
Is the object it destroying somewhere like Workspace or Lighting where client doesn’t have effective access to with filtering enabled?
ZacBytes
(Zachary)
December 9, 2017, 5:44am
#3
Its filtering enabled, the object is in startergui and so is the textbutton, so it has access to destroy it. But it’s not cloning or destroying for some reason
StarterGui cannot be accessed by a client in that case. Do you mean PlayerGui inside the player?
Any errors?
Also it might be better to save it to a variable so you don’t need to risk anything:
local MotionBlur = script:WaitForChild("MotionBlur")
local CurrentMotionBlur
script.Parent.MouseButton1Click:Connect(function()
if CurrentMotionBlur then
CurrentMotionBlur:Destroy()
else
CurrentMotionBlur = MotionBlur:Clone()
CurrentMotionBlur.Parent = script.Parent.Parent... -- continue on
end
end)
1 Like
Try my code and see how it works then
Are you sure it’s setup right? This seems a bit odd.
ZacBytes
(Zachary)
December 9, 2017, 5:53am
#12
ill try making another test script
ZacBytes
(Zachary)
December 9, 2017, 5:56am
#13
i tried using this
local CurrentMotionBlur = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.MotionBlur
CurrentMotionBlur:Destroy()
and its not destroying as well
ZacBytes
(Zachary)
December 9, 2017, 5:59am
#16
It even prints “Motion blur disabling/enabling” its just not destroying/cloning
Wow this makes no sense
Would I be able to join the TC?
ZacBytes
(Zachary)
December 9, 2017, 6:00am
#18
I don’t think so… but i can give you the file
Whatever works
Add me on discord if you like, and we can go over this
EmeraldSlash#9138
ZacBytes
(Zachary)
December 9, 2017, 6:09am
#20
Found an error
14:05:39.300 - The Parent property of MotionBlur is locked, current parent: NULL, new parent Workspace