I am making a pushing platform that should move fast when a player is pushing, and when a player stops pushing, it flings back. These are the contents of the pushing platform.
Contents of push platform:
As you can see, the pushing platform uses constraints, attachments, and vector force.
The pushing platform does work, but when you push it, it moves very slowly. Also, when a player stops pushing it, it doesn’t fling back automatically.
Oops hehe yea sorry! Ok so the VectorForce is used to return the platform to the start. And by moves very slowly I mean when the player is pushing the platform, the platform doesn’t go straight to the finish really fast, but instead moves very slowly as demonstrated in the video.
Well I think, the VectorForce is acting against the Player’s force, so maybe that causes the platform to move slower than if it doesnt contain the vectorForce.
Think that the platform have certain Density, the player is fighting against the gravity to push thet object with mass over the space, plus, if the VectorForce is applying force to push back, then the player is fighting against the mass and the force.
I would remove the VectorForce and manage the movement by scripting. If you change ur Prismatic behaviour to Servo, you will have TargetPosition, that can be accesed by script and make it go back to the original position when the platform reach certain distance from the initial position
If you set the ActuatorType of ur Prismatic to Servo.
You will be able to set the TargetPosition, Speed etc.
Then you can change the values Dinamically by scripting (script intended to be placed inside a model containing 2 parts, “pistonHold” is the root part of the constraint and “piston” is the name of the Prismatic Constraint inside “pistonHold”):
local pistonMotor = script.Parent.pistonHold.piston
while true do
if pistonMotor.CurrentPosition < 6 then
pistonMotor.TargetPosition = 60
end
if pistonMotor.CurrentPosition > 58 then
pistonMotor.TargetPosition = 5
end
wait(2)
end
Hmm but still, wont this just make it go back and forth instead of making the player do all of the work? My goal is for the player to push the platform, and when he/she stops the platform shoots back.
Yup well, I just gave u a quick example on how to achieve it…
You should add in the script, some statements to check the player, to set the values, the behaviour, the times, etc. Implement mechanics into ur system
I would be happy to help you, thats why the forum is here, isnt?
Hey! Well Im still learning so I wanted to test that BasePart.Touched() event I was talking with you (never tried it before :v)
So I made some tests, is this somehow similar to what u are trying to make?
It’s a little glitchy cause, this should be made on clientSide and I just went ServerSide (recording its very cheap too but yeah! xD)
Sorry for the late reply.
Im sending u a cap, I hope its not messy. Just dont forget to name the Prismatic and parts the same way that in the image.
Holder, MovePlate, and PrismServo are the important ones. And the script should be placed as children of the main model container.
The script is a little glitchy cause its just an example, in order to make it work better, you should modify it for a LocalScript and calling RemoteEvents, maybe using HeartBeat, etc.
local prismServo = script.Parent.Holder.PrismServo
local movingPlate = script.Parent.MovePlat
local PlatformLock = false -- basic lock
local HRP -- HRP of the player standing on platform
local function doLoop()
while PlatformLock do -- Loop with lock, if a player already touched the part
local distance = (HRP.Position - movingPlate.Position).Magnitude -- Measure distance player - part
if distance > 5 then -- If player left platform
PlatformLock = false -- unlock the platfrom
prismServo.ActuatorType = 2 -- set Servo again
prismServo.TargetPosition = 1 -- Position near the base holder
end
wait(1) -- Checking Proximity each 1 second
end
end
local function plateStand(playerPart) -- On touched part function
if PlatformLock then -- if part has been already touched
else -- if part is first time touched
local player = playerPart.Parent -- who touched
HRP = player:FindFirstChild("HumanoidRootPart")
--print(HRP)
if HRP == nil then
else
PlatformLock = true -- unlock the updating loop to check distance
prismServo.ActuatorType = 0 -- prismatic actuator to Default (to move part on normal push)
doLoop() -- call the loop
end
end
end
movingPlate.Touched:Connect(plateStand) -- on touched part event call plateStand()