Hi,
I am making a parkour game on Roblox. The levels in it are randomly generated. My parkour game has kill bricks, but it also has moving parts.
These moving parts are being moved by the server. I do not want this, because my players may be in a laggy area, so the kill bricks may kill them if they server doesn’t update their client but kills them when it intersects with their body.
What I’m asking is, how can I move parts exclusively on the client? I know how to do it normally, you would just give the path of the object you want to move, but the game is randomly generated levels, some of which may have the same name, so I can’t. I wish I could insert LocalScripts INSIDE of Parts, and use their relative path (script.Parent.Position etc.)
I’ve thought about using ModuleScripts, but I can’t unrequire a ModuleScript, so once a Tower has finished, this code will continue looping, moving parts that aren’t there, thus causing an error.
I’ve also thought about using LocalScripts, and I’ve even wrote a little script, but it doesn’t work. I move the scripts into a folder in StarterPlayerScripts. I also notice it messes up a GUI of mine. Here is my script:
local Tower = game.Workspace.Tower
local TowerScripts = game.StarterPlayer.StarterPlayerScripts.TowerScripts
game.ReplicatedStorage.Events.TowerChanged.OnClientEvent:Connect(function()
LoadTowerScripts()
end)
function LoadTowerScripts()
TowerScripts:ClearAllChildren()
local TowerDescendants = Tower:GetDescendants()
for i,v in pairs(TowerDescendants) do
if v.ClassName == "LocalScript" then
local ScriptClone = v:Clone()
ScriptClone.Parent = TowerScripts
end
end
end
I know a game that does this: Tower of Hell - Roblox
In this game, you can see other players going through moving kill bricks, and not dying. You can also prove they are doing it on the client by right clicking and holding on the top bar of the window (if you are on windows, this pauses your client). When you unhold, the moving parts are in the same position they were in before you pause your client.
How do I go about accomplishing this? Thank you, I know this is a very strange issue that I’m asking about.
My game is being released tomorrow, so I’d appreciate if I got feedback quickly.