Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

script is not a valid member of LocalScript?

Heya! I found an old script of mine and I'm trying to use renderStepped instead ofwhile wait() do so its smoother however I keep getting script is not a valid member of LocalScript on line 19

local star = Instance.new("Part")
star.BrickColor = BrickColor.new("Institutional white")
star.FormFactor = "Custom"
star.Size = Vector3.new(40,40,40)
star.CanCollide = false
star.TopSurface = "Smooth"
star.BottomSurface = "Smooth"
star.Material = "SmoothPlastic"

local glow = Instance.new("PointLight")
glow.Brightness = 3
glow.Parent = star

local msh = Instance.new("SpecialMesh")
msh.MeshType = "Sphere"
msh.Parent = star


local motion = script.Script

game:GetService("RunService").RenderStepped:connect(function()
   	local dropClone = star:clone()
	dropClone.Position = Vector3.new(800,math.random(-300,300),math.random(-300,300))
	dropClone.Parent = game.Workspace
	dropClone.Anchored = true
	local move = motion:Clone()
	move.Parent = dropClone
	move.Disabled = false
end)

1 answer

✓ Accepted answer
local star = Instance.new("Part")
star.BrickColor = BrickColor.new("Institutional white")
star.FormFactor = "Custom"
star.Size = Vector3.new(40,40,40)
star.CanCollide = false
star.TopSurface = "Smooth"
star.BottomSurface = "Smooth"
star.Material = "SmoothPlastic"

local glow = Instance.new("PointLight")
glow.Brightness = 3
glow.Parent = star

local msh = Instance.new("SpecialMesh")
msh.MeshType = "Sphere"
msh.Parent = star


local holder = script.Parent
local motion = holder.LocalScript.Script -- Or what ever the script name is.

game:GetService("RunService").RenderStepped:connect(function()
    local dropClone = star:clone()
    dropClone.Position = Vector3.new(800,math.random(-300,300),math.random(-300,300))
    dropClone.Parent = game.Workspace
    dropClone.Anchored = true
    local move = motion:Clone()
    move.Parent = dropClone
    move.Disabled = false
end)


You cant do motion = script.Script because it is not a property of the local script.

This discussion is preserved as it was. New answers, comments, and votes are closed.