#Does a module script can use renderstepped

31 messages · Page 1 of 1 (latest)

tidal furnace
#

yes if u create a table to handle the things u add to that table like ```lua
local module = {}

function module.new(render,loop)
local self = setmetatable({},module)
self.Render = render
self.Loop = loop
return self
end

function module:SetRender()

end

function module:SetLoop()

end

return module```

rare silo
#

module.__index = module

normal swift
#

Shouldi do

#

a modulescript

#

and do require

#

can you explain me more

rare silo
#

The code that they just pasted will need a .__index

#

Just from when you access from the child table an index that does not exist

normal swift
#

So instead of this

#

game:GetService("RunService").Heartbeat:Connect(updateRegion)

#

I do require?

#

require(moduleemplacement)??

#

I dont understand can i get a lil more help Bmike?

rare silo
#

Sorry yes busy at the moment also I dont think the code the other guy sent will do you any good but could I guess I will brb

normal swift
#

you afk?

rare silo
#

For some time yes ping the other guy

normal swift
#

@tidal furnace I hope he dosent kill me i geuss

tidal furnace
rare silo
#
local module = {}

module.__index = module

function module.new(render,loop)
      local self = setmetatable({},module)
      self.Render = render
      self.Loop = loop
      return self
end

function module:SetRender()

end

function module:SetLoop()

end

return module
normal swift
#

i MAKE AN FIReall client and a module it working fine but

#

like since im using cframe

#

So to make the v infront of player

#

Im doing smth like this

#

function module.Stun(v,Time,look,Prob,from,Pos)
if Time == nil then
Time = 2
end
if not v.Parent:FindFirstChild("Armor") and v.Parent.Humanoid.Health > 0 then
if not v.Parent:FindFirstChild("Stun") then
if from then
if from.Character:FindFirstChild("Stun") or from.Character:FindFirstChild("Stun2") or from.Character:FindFirstChild("Stun1") then
return
end
end
if v.Parent:FindFirstChild("Stun1") then
v.Parent:FindFirstChild("Stun1"):Destroy()
end
if v.Parent:FindFirstChild("Stun2") then
v.Parent:FindFirstChild("Stun2"):Destroy()
end

        local Stun = Instance.new("BoolValue")
        Stun.Parent = v.Parent

        if Prob == "Stun1" then
            Stun.Name = "Stun1"

            v.Parent.HumanoidRootPart.CFrame = CFrame.new(Pos.X,Pos.Y,Pos.Z) * CFrame.new(0,0,-4) * CFrame.Angles(0,math.rad(180),0)

        elseif Prob == "Stun2"  then
            Stun.Name = "Stun2"
            v.Parent.HumanoidRootPart.CFrame = CFrame.new(Pos.X,Pos.Y,Pos.Z) * CFrame.new(0,0,-4) * CFrame.Angles(0,math.rad(180),0)

        else

        end
        RemoveItem(Stun,Time)
    else

        RemoveItem(v.Parent:FindFirstChild("Stun"),Time/2)
    end
end
return v

end

#

But idk if is suck

#

like can be optimized

#

cause it does