#( Solved ) how to check player bump wall, and player gonna stop?

95 messages · Page 1 of 1 (latest)

dusk novaBOT
#

studio** You are now Level 3! **studio

terse plaza
#

What?

hollow juniper
#

raycasting

#

ig

#

or Touched

sterile mirage
#

how to use Touched?

#

local function CheckRay(chr,hrp,distance,updistance,duraction)

    local function check_collision(last_position: Vector3, position: Vector3)

        local ray = RaycastParams.new()
        ray.FilterType = Enum.RaycastFilterType.Blacklist
        ray.FilterDescendantsInstances = {chr}

        local ray_result = workspace:Raycast(last_position, position - last_position, ray);

        return ray_result;

    end

    local RunService = game:GetService('RunService');

    local velocity = Instance.new("BodyVelocity",hrp)
    velocity.MaxForce = Vector3.new(999999,0,999999)
    velocity.Velocity = hrp.CFrame.LookVector * distance + hrp.CFrame.UpVector * updistance

    game.Debris:AddItem(velocity,duraction)

    local last_position = hrp.Position;

    local conn;

    conn = RunService.Heartbeat:Connect(function()

        local collision_result = check_collision(last_position, hrp.Position);

        if (collision_result) then
            
            local part = collision_result.Instance
            
            velocity.Velocity = part.Position

            conn:Disconnect()

        end

    end)
    
end

#

this script

#

please help

sterile mirage
terse plaza
#

Whats that, ChatGPT? YouTube? ToolBox? Forums?

sterile mirage
#

by me..

hollow juniper
#

its by him

#

he use

#

snake case

sterile mirage
#

what's wrong that script?

terse plaza
#

And yet, you dont know how to use .Touched

sterile mirage
#

i know

hollow juniper
#

but wdym player gonna stop?

terse plaza
#

In lua you dont need ; at the end of lines

sterile mirage
#

wall knock

hollow juniper
#

I do that too

#

in my scripts

terse plaza
#

A well, I guess you can but ist not needed like in other languages

sterile mirage
#

i rlly hate player flipping

hollow juniper
#

u dont need, but u can, syntax ignore that ;, but u can use it for tables instead of ,

#

local players = {1; 2; 3}

hollow juniper
#

;compile

local players = {1; 2; 3}

for i, v in next, players do
    print(i,v)
end
dry rockBOT
#
Program Output
11
22
33

terse plaza
#

I know that agony

hollow juniper
#

okie

sterile mirage
#

what's mean players table?

terse plaza
#
local function CheckRay(chr,hrp,distance,updistance,duraction)
    local function check_collision(last_position: Vector3, position: Vector3)
        local ray = RaycastParams.new()
        ray.FilterType = Enum.RaycastFilterType.Blacklist
        ray.FilterDescendantsInstances = {chr}
        local ray_result = workspace:Raycast(last_position, position - last_position, ray)
        return ray_result
    end

    local RunService = game:GetService('RunService')

    local velocity = Instance.new("BodyVelocity",hrp)
    velocity.MaxForce = Vector3.new(999999,0,999999)
    velocity.Velocity = hrp.CFrame.LookVector * distance + hrp.CFrame.UpVector * updistance

    game.Debris:AddItem(velocity,duraction)
    local last_position = hrp.Position
    local conn

    conn = RunService.Heartbeat:Connect(function()
        local collision_result = check_collision(last_position, hrp.Position)
        if (collision_result) then
            local part = collision_result.Instance
            velocity.Velocity = part.Position
            conn:Disconnect()
        end
    end)
end

better colors hehe and less spacing

sterile mirage
#

what's change?

terse plaza
#

Nothing yet, just the colors, the spacing between lines and I removed the ; MUHAHA

#

Im "reading" the script now

sterile mirage
#

so funnnnnnnyyyyyy

hollow juniper
#

but what u mean

#

stop

#

anchor it?

#

when wall touched

#

or what

sterile mirage
#

i used that script

hollow juniper
#

💀

#

man:(

sterile mirage
hollow juniper
#

just tell what u mean

#

stop

#

player

terse plaza
#

Why are you trying to remake something agony

hollow juniper
#

thanks will watch the entire

#

video

terse plaza
hollow juniper
#

so he just dont want

#

to fling

sterile mirage
#

use dash and if wall in front of player then stop dash

#

i need this system

terse plaza
#

Use raycast or touched when player is close or hits a wall then just stop the function

hollow juniper
#

add velocity

#

loss

#

if close to wall

terse plaza
#

Depending on your script, I just gave you the raw idea

#

In this case, you should stop the velocity

#

Or anchor the player so he cant move (dont know if velocity affects anchored parts/models)

hollow juniper
#

nah anchor

#

would be to fix

#

and unalive

sterile mirage
#

make velocity slow down?

hollow juniper
#

make player move speed of grandma

#

so player

#

not get flung

sterile mirage
#

lol

#

that's so fast

terse plaza
#

Thats you when you are testing it

sterile mirage
#

ok i'll test

#

wait

#

hmm

terse plaza
#

You could even use tween lol
Create a part at n stunds in your face and check if is colliding with something, if it doesnt then tween the player to that position but if it collides, then just place the part closer and closer until it doesnt collide troll

terse plaza
sterile mirage
#

ye..

#

if wall then player move wall near

#

but that stop during dash..

#

howw i fix that?

sterile mirage
#

OW

#

Worked!!

#

ty for idea