0

# Why can't I set this script's Source?

Part = Instance.new("Part")
Part.Size = Vector3.new(1,3,3)
Part.BrickColor = BrickColor.new(23)
Part.Transparency = .3
Part.Reflectance = .3
Part.Parent = game.Lighting
Part.Name = "Trail"
s = Instance.new("Script")
s.Parent = game.Lighting.Trail
s.Source = [[
wait(2)
script.Parent:Destroy()
]]


2
Axstin 55
7 years ago

As far as I know, you can't edit a script's source with a normal Script or LocalScript. That's probably the problem. :P

0
Indeed, just replace the "s.Source = [[ wait(2) script.Parent:Destroy() ]]" part with "wait(2) s:Destroy()". TheMyrco 375 — 7y
1

Just a side note, you should use ServerStorage instead of Lighting for storing items. They're more or less the same thing, except ServerStorage is official

Also, you could probably make the separate delete script beforehand, make it Disabled = true, place it into ServerStorage and THEN clone it into the trail. Then, when you want it to, make Disabled = false, so that it doesn't delete itself while in ServerStorage.

game.Debris:AddItem(game.Lighting.Trail, 2)