Jetpack works, the parts are only visible to the client?

I have an issue with a jetpack. It’s a HopperBin placed under StarterPack. The script works, however the parts attached to the HopperBin is not visible to players other than the client itself. How do I make it visible?

It seems that I also have encountered this problem with a F3X tool previously, where when someone builds something and steps on it, I can’t see it and can go through it.

Any help is appreciated, thanks.

Hopper Bins are deprecated, meaning that this object is not being maintained anymore and shouldn’t be used for games. As far as I know, Hopper Bins don’t replicate properly across the client-server boundary which explains why other players don’t see the parts of the jetpack. The issue with the F3X tool is completely different, this was caused because of the mandatory Filtering Enabled update which prevented unauthorised client changes to replicate server-wide, I think the fix for the F3X was to add support for filtering with Remote Events/Functions.

Additional Information:
You should be using Tool objects or your own custom tool implementation to replace Hopper Bins.

3 Likes

If that’s so, how can I convert HopperBin scripts to a Tool?

Let’s take this as an example, how do you convert it to a Tool script?

function Equipped(Mouse)
IsEquipped = true
Mouse.Button1Down:connect(function() Button1Down(Mouse) end)
Mouse.KeyDown:connect(KeyDown)
Mouse.KeyUp:connect(KeyUp)

UpdateGui()

wait(1)
Regen()

coroutine.resume(coroutine.create(function()
script.Parent.Deselected:connect(function() IsEquipped = false Regening = false if Gui ~= nil then Gui:remove() Gui = nil end end)
end))
end

script.Parent.Selected:connect(Equipped)

The Tool object has these events:

Tool.Equipped(Mouse) --fires when the tool is equipped and returns the client's mouse
Tool.Unequipped() --fires when the tool is unequipped (and/or dropped?)
Tool.Activated() --fires when the client clicks while the tool is equipped
Tool.Deactivated() --fires when the left mouse button is released

References:
https://developer.roblox.com/articles/Player-Tools
https://developer.roblox.com/api-reference/class/Tool

To apply this to your script, I’ll just modify the basics of it:

function Equipped(Mouse)
    --code..
end

--code..

coroutine.resume(coroutine.create(function()
    script.Parent.Unequipped:Connect(function() IsEquipped = false) end)) --etc..
end

script.Parent.Equipped:Connect(Equipped)

The event names are pretty similar and should be easy to follow, so I guess switching over to Tool objects should be easy.

1 Like

It doesn’t really work.

jetpack.rbxm (20.7 KB)

You were using the wrong Event names for the Mouse object.

Go to Local Script, Lines 221 and 222

221. Mouse.MouseButton1Down
222. Mouse.MouseButton1Up

Should be

221. Mouse.Button1Down
222. Mouse.Button1Up

Fixed that, still doesn’t work.

Are there any errors in the output?

It says in blue line, something’s on Line 220. I think it’s the function.

The error is coming from your Thrust function on line 84, it has something to do with the object “Middle” not being a valid child of the ThrusterPack model.

It’s fixed, now the error comes from various lines, 86, 162, 220. And why when I select the tool the first time, suddenly my body speeds up abruptly?

That’s exactly the error I was talking about:
image

Also we’re getting kind of far from the your post’s original goal, the Hopper Bin has been successfully replaced with a Tool object, so if there are any other issues with your Jetpack, perhaps create another post :slight_smile: I have other things to attend to right now, so yeah.

Referring to the parts on your jetpack only being visible on the client, the only reason your parts are invisible is because your Jetpack script is client sided. LocalScripts won’t make changes to the server, other than through RemoteEvents and RemoteFunctions you setup. If you wish for your jetpack to appear for other people, you’ll need to manage everything to do with “putting the jetpack on” on the server, so likely you’ll have to move all welding related scripts over to the client, and track when the tool is equipped.

I also looked at your model, and I noticed some particle emitters, so you will need to either make them listen for the Activated Connection as well, or if you are using some form of mouse/keyinput detection on the client, have it send a message to the server to simulate this. Essentially, right now your scripts utilise mouse events rather than the tool itself being activated, so you should make sure when you remake the script, you set the events to listen to when the tool is activated, rather than when the mouse is clicked.

1 Like