Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago
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()
]]

3 answers

Log in to vote
2
Answered by
Axstin 55
10 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 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

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.

Log in to vote
0
Answered by 10 years ago

Read this http://wiki.roblox.com/index.php?title=ProtectedString

And also just use this instead of having to insert an entirely new script.

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

Answer this question