so like title said I'm making a game about slashing stuff if you look at the video sometimes walls don't get slashed at all and if they do it's weird slashes(which I tried to counter by stretching the slash a lot so it doesn't like slash it multiple times when falling down or slashes it as soon as it touches the wall and only goes in a bit deep) but it's still happening and also when a slash hit's it's nowhere close to how my slash is angled or where it hit the wall from
here's the server script handling the slashing of the walls
#making a game for fun to slash things but the slashes are weird and random for some reason
1 messages · Page 1 of 1 (latest)
YO
LET ME SEND THE SCRIPT
and here's the script inside the slash part
local slash = script.Parent
local speed = 300
local rs = game:GetService("ReplicatedStorage")
local hitWalls = {}
local function moveSlash()
while slash and slash.Parent do
local rayOrigin = slash.Position
local rayDirection = slash.CFrame.LookVector * (speed * 0.1)
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {slash}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local result = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if result and result.Instance then
local hit = result.Instance
if hit.Parent and hit.Parent.Name == "Walls" and not hitWalls[hit] then
hitWalls[hit] = true
local stretchAmount = 500
slash.Size = slash.Size + Vector3.new(stretchAmount, 0, 0)
slash.CFrame = slash.CFrame * CFrame.new(stretchAmount/2, 0, 0)
local ownerUserId = slash:GetAttribute("Owner")
local owner = game.Players:GetPlayerByUserId(ownerUserId)
if owner then
rs.SlashWall:Fire(owner, hit, slash)
end
end
end
slash.CFrame = slash.CFrame * CFrame.new(speed * task.wait(), 0, 0)
end
end
task.spawn(moveSlash)
so yeah I had to make it a txt :c