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

script is not a valid member of LocalScript?

Asked by
rootx 15
10 years ago

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

Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
10 years ago
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.

Ad

Answer this question