I have a stroller tool for a roleplaying game that picks players up when it hits them but for some reason it only works correctly when it is used on a player that spawned in before the player that is picking them up did. If someone tries to pick someone up that spawned in after them then they will pick them up, fall down, walk weirdly with a weird camera angle, start tilting towards the side, and eventually fall down again. I am not quite sure why this happens, and I don’t know how to fix it. Below is a screenshot of inside of the tool.
I believe you have a network ownership issue since there is a seat within your tool. Read up on the API here and i would think you will need to assign network ownership to the player who equips the tool:
I appreciate the help! I put this script inside of the seat but it didn’t do anything. Is that the wrong thing?
-- Script inside of VehicleSeat
local VehicleSeat = script.Parent
VehicleSeat.Changed:Connect(function(prop)
if prop == "Occupant" then
local humanoid = VehicleSeat.Occupant
if humanoid then
local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
if player then
VehicleSeat:SetNetworkOwner(player)
end
else
VehicleSeat:SetNetworkOwnershipAuto()
end
end
end)
What a minute… i just noticed, you have a tool, so you dont want to do vehicle seat… you want it to be Equipped, not occupant i believe… so that whoever is equipping the tool has network ownership, not the other player who is sitting.
So instead of a Changed function you will want to do Tool.Equipped function.
Like this?
-- Script inside of VehicleSeat
local VehicleSeat = script.Parent
script.Parent.Parent.Equipped:Connect(function(prop)
if prop == "Occupant" then
local humanoid = script.Parent.Parent.Humanoid
if humanoid then
local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
if player then
VehicleSeat:SetNetworkOwner(player)
end
else
VehicleSeat:SetNetworkOwnershipAuto()
end
end
end)
Scripting isn’t my strong suit, but try this:
local VehicleSeat = script.Parent
local Tool = script.Parent.Parent
Tool.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
VehicleSeat.Changed:Connect(function(prop)
if prop == "Occupant" then
local humanoid = VehicleSeat.Occupant
if humanoid then
local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
if player then
VehicleSeat:SetNetworkOwner(player)
end
else
VehicleSeat:SetNetworkOwnershipAuto()
end
end
end)
end
end)
Thank you, it still does the same thing though unfortunately. I’m not sure what the issue is.