Anyway of creating a functional stroller?

  1. What i want to achieve I would like to script

  2. The issue There are not tutorials of making strollers anywhere and the toolbox strolles are broken like this:
    https://gyazo.com/7d21e9b68f2cd77159a1c1cddcfb7e22
    https://gyazo.com/a79427bd4f626eb123d20d6311c686e7

  3. What i want you to do I would like you to recommend me some videos/topics/API reference. Whatever you think i will learn with it

Part of the free model script:

function onTouched(hit)
	if (hit.Parent:findFirstChild("Humanoid") ~= nil) and (script.Parent:findFirstChild("SeatWeld")) == nil then
		script.Parent.Anchored = false
		wait()
		local weld = Instance.new("Weld")
		weld.Name = "SeatWeld"
		weld.Parent = script.Parent
		weld.Part0 = script.Parent
		weld.Part1 = hit.Parent:findFirstChild("Torso")
		weld.C0 = CFrame.new(0, 3, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
		weld.C1 = CFrame.new( 0, 0.600000024, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0)
		hit.Parent.Humanoid.Sit = true
		wait()
		script.Parent.Anchored = true
		for i = 1, math.huge do
			wait()
			if hit.Parent.Humanoid.Jump == true then
				weld:remove()
			end
		end
	end
end

script.Parent.Touched:connect(onTouched)

In my thought on this, I believe that having the stroller 100% no collide other than the seat (only because I’m not sure if seats work if they are in NoCollide). I also think that disabling physics on the character using humanoid:ChangeState(Enum.HumanoidStateType.Physics).

I had to use this while making a Ragdoll System that works while the player is alive and without “killing them” while rebuilding them.

To re-enable physics just redo humanoid:ChangeState(Enum.HumanoidStateType.Physics) again with an input detection on the Space Key.
This may or may not work, again this is just my thought.

–

EDIT: Use the Code Formatting

print("Hello World")

In the future to format code. ``` surround code by that and it should auto-format, or click the </> Button to input it automatically.

2 Likes

I have 2 problems about this

  1. The stroller doesn’t have a seat
  2. What line should i change?

Okay, I sent that message to like 2AM so bare with me, after reviewing the code, the code is very… bad. (I will talk about that later).


EDIT: Please note - this Free Model was seemingly made A LONG TIME AGO therefore it might have other bugs or issues because most of the code will likely be depreciated.


If the script is part of a model, then it maybe better to add a seat to the Object by loading the Object into the world and editing it, then overwriting the original. As far as I can tell the model is loaded from something like ServerStorage or ReplicatedStorage. From what I can tell in the script itself it actually Sits the Player. If you look at

script.Parent:findFirstChild("SeatWeld") == nil

then

weld = Instance.new("Weld")

You can see this. However, it FORCE sits the player for some unknown reason.

Please look at the Seat Documentation for further infomation.




Now for the code itself.

for i = 1, math.huge do
    wait()
    if hit.Parent.Humanoid.Jump == true then
        weld:remove()
    end
end

There is no timeout paticularly on the check to see if the player jumps. Which can cause sever performance drops, especially because this method would have to be programmed Server Sided.

There is also an Event to check if a Player Jumps. StateChanged.

hit.Parent.Humanoid.StateChanged:Connect(function(state))
    if state = Enum.HumanoidStateType.Jumping then
        weld:Destroy()
    end
end)

This is already a complete fix for that problem. Please note: remove() is depreciated and Destroy() should be used instead.

There are many problems with the code. MANY. This is the problem with the Free Model. I believe it would be best to completely re-write the entire code/make your own from scratch. Even if you start with a SeatWeld Part and just try and move it around, before then attaching that SeatWeld to the Player (as in the person moving the “Stroller” around).

1 Like

PS: Please give me a resonse on how this goes.

The best i did was NoCollide it, replacing remove() with Destroy(),
and adding a seatweld wich i tried to weld and still doesnt weld

I may try making one from scratch

I would highly recommend that.

Again, try and only use Free Models as an example, and then make your own from it. Your version, even if you’re a newb at Roblox Lua, will likely still be made better, due to the age of many free models.

Im sorry, for late answer but here is what i got
I have no idea how to fix the weird movement

1 Like

Also sorry for the late reply.

It seems to move the pivot point of the rotation of the character when you use the tool.
I have no context for how the tool works, where if you equip it it welds the stroller to the hand or if it does it via an actual welding method for tools.

On the 2nd gif, it seems that there are collsions being applied to the stroller when you equip it, then the collisions are disabled, causing the weird fall-over, based on the angle of the hand during the walk animation.

To stop the weird movement, i think you need to make all the parts massless (select all the parts and enable the massless property for all of them)

1 Like