Hello, I am trying to make a system where you can’t fall off the edge in Roblox. It is similar to the sneaking system in Minecraft(https://minecraft.fandom.com/wiki/Sneaking). I am having trouble finding solutions to making this system. Could somebody help me?(Any help will be greatly appreciated.)
Well, I could recommend an Idea which could potentially help with this.
So as a player presses/holds down a key bind, you’re animation plays which you will also have to get something to activate in order for the Server to recognize the event. From there the event would put walls around blocks to keep the player from falling off of it.
Then as/if the player lets go of the key bind, the activated value would be put back to false hiding the walls (you can go through them again) and the animation would stop as well.
You can have a folder of walls in the workspace and change the CanCollide value of each one in a LOCAL SCRIPT. It has to be client-sided otherwise the other players who wanted to go off of an edge would not be able to. The animation would replicate from client to server.
Hello, I have tried this method, but it doesn’t seem like the Local Script is running. Here is my code:
local RS = game:GetService("ReplicatedStorage")
local Event = RS:WaitForChild("CrouchEventServer")
local part = script.Parent
print("Testing if this is running")
Event.OnClientEvent:Connect(function()
part.CanCollide = true
end)
I also placed this code inside the part(an image will be attached below), did I maybe misplace the script or is there another reasoning behind this?
Hey everyone, I’ve been testing out the new system for a couple days now. It seems to be working fine. There is one problem though, if I were to make a block placement system, how would I be able to implement the crouch system to it? An idea I have is to put walls around the blocks that will be placed and when the player presses the button for crouch, it will make the walls CanCollide = true. Is there any other ways of doing this?