You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to make a bullet slide along the ground smoothly in one direction, the way I got this to work is with a prismatic constraint. -
What is the issue? Include screenshots / videos if possible!
The problem is that in this video you can see the prismatic constraint pause in the middle of its extension, which is bad.
https://youtu.be/QI6dexYsQfs
Also if you find it hard to see you can test it yourself on the game here
Shoot - Roblox
Other ways I have tried to make the bullet move is by continually updating its position via a +vector3 and another method is via a floating block with an AssemblyLinearVelocity. Neither worked, The floating block did not float/was not frictionless, and the positional method was not smooth
It is worth saying this issue does not happen in Roblox studio or with the first bullet placed in the area, or strangely at all in the next rounds. I am wondering if this is a known issue with prismatic constraints and how to solve this/alternatives.
here is the code for making the bullet (ServerSide).
local function makepart(Type,parent,Name,position,anchor,size,transparency,CanColide,CanQuery,CanTouch,Attach0,Attach1)
local part=Instance.new(Type)
part.Parent=parent
part.Name=Name
if Type=="Part" then
part.Position=position
part.Anchored=anchor
part.Size=size
part.Transparency=transparency
part.CanCollide=CanColide
part.CanQuery=CanQuery
part.CanTouch=CanTouch
part.TopSurface=Enum.SurfaceType.Smooth
part.BottomSurface=Enum.SurfaceType.Smooth
elseif Type=="Attachment" then
part.Position=position
elseif Type=="PrismaticConstraint" then
part.Attachment0=Attach0
part.Attachment1=Attach1
part.ActuatorType=Enum.ActuatorType.Motor
end
return part
end
local function infrastructuremaker(position,BSize)
local model=makepart("Model",game.Workspace,"Bullet")
local bullet=makepart("Part",model,"Bullet",position+Vector3.new(0,BSize.Y/2,0),false,BSize,0,false,false,true)
local Basepart=makepart("Part",model,"Anchor",position+Vector3.new(-4,BSize.Y/2,0),true,Vector3.new(2,2,2),1,false,false,false)
local attachment1=makepart("Attachment",Basepart,"AnchorAttachemt",Vector3.new(1,0,0))
local attachment2=makepart("Attachment",bullet,"BulletAttachemt",Vector3.new(-1,0,0))
local Prism=makepart("PrismaticConstraint",bullet,"PrismaticConstraint",nil,nil,nil,nil,nil,nil,nil,attachment1,attachment2)
Prism.MotorMaxForce=1000000
return bullet,Prism,model
end
BulletEvent.OnServerEvent:Connect(function(player,position,speed,damage,Bsize)
if CanPlace.Value then
task.spawn(function()
local bullet,Prism,model=infrastructuremaker(position,Bsize)
Prism.Velocity=speed
bullet.Touched:Connect(function(hit)
if hit.Name=="Sheild" then
model:destroy()
local durability=hit:FindFirstChild("Durability")
local strength=hit:FindFirstChild("Strength")
local colordown=math.round(162/strength.Value)
local deletecolor=Color3.fromRGB(colordown,colordown,colordown)
durability.Value=durability.Value-damage
if durability.Value<=0 then
hit:destroy()
end
for i=1,damage do
hit.Color=Color3.new(hit.Color.R-deletecolor.R,hit.Color.G-deletecolor.G,hit.Color.B-deletecolor.B)
end
elseif hit.Name=="Goal" then
Damager:Fire(damage)
end
end)
wait(10)
model:destroy()
end)
end
end)