#( Solved ) how to check player bump wall, and player gonna stop?
95 messages · Page 1 of 1 (latest)
What?
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
how to use this?
by me..
what's wrong that script?
And yet, you dont know how to use .Touched
i know
but wdym player gonna stop?
In lua you dont need ; at the end of lines
wall knock
its preference
I do that too
in my scripts
A well, I guess you can but ist not needed like in other languages
i rlly hate player flipping
u dont need, but u can, syntax ignore that ;, but u can use it for tables instead of ,
local players = {1; 2; 3}
Well yea, I know that
;compile
local players = {1; 2; 3}
for i, v in next, players do
print(i,v)
end
11
22
33
I know that 
okie
what's mean players table?
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
what's change?
Nothing yet, just the colors, the spacing between lines and I removed the ; MUHAHA
Im "reading" the script now
i used that script
this
Pro Red enjoyers
Like and Subscribe if you see this!!!!!
Roblox profile: https://www.roblox.com/users/119260934/profile
Game: https://www.roblox.com/games/8534845015/Made-In-Heaven-Sakura-Stand
like this
Why are you trying to remake something 
The hell you do xd
Use raycast or touched when player is close or hits a wall then just stop the function
use break?
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)
make velocity slow down?
Thats you when you are testing it
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 
Isnt that what you want?
** You are now Level 3! **