Hello i am making a thing where if you touch a part you are going to be queued for a game however the teleport party async function is saying
10:24:31.416 - Stack End 10:24:31.452 - Unable to cast value to Object 10:24:31.456 - Stack Begin 10:24:31.457 - Script 'Workspace.Part.Script', Line 34 10:24:31.459 - Stack End
This may be because of the hierarchy
https://cdn.discordapp.com/attachments/729539918094794827/750395116325437591/unknown.png
here is the code
local players = {}
local debounce = false
if debounce == false then
debounce = true
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
table.insert(players, 1, hit.Parent.Name)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
humanoid.Parent.HumanoidRootPart.Position = game.Workspace.ParkBench.Seat1.Position
game.Workspace.ParkBench.Seat1.Value.Value = true
if game.Workspace.ParkBench.Seat1.Value.Value == true then
humanoid.Parent.HumanoidRootPart.Position = game.Workspace.ParkBench.seat2.Position
game.Workspace.ParkBench.seat2.Value.Value = true
end
if game.Workspace.ParkBench.seat2.Value.Value == true then
humanoid.Parent.HumanoidRootPart.Position = game.Workspace.ParkBench.Seat3.Position
game.Workspace.ParkBench.Seat3.Value.Value = true
end
if game.workspace.ParkBench.Seat3.Value.Value == true then
script.Parent.Parent.BusStopShelter.Players.Value = 3
end
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
debounce = false
if script.Parent.Parent.BusStopShelter.Players.Value == 3 then
local animator = require(game.Workspace.Leave.Animator)
animator.NewTween:Play()
local teleportservice = game:GetService("TeleportService") --right here
teleportservice:TeleportPartyAsync(removedid, players) --something is wrong with this part
end
end
end)
wait(5)
table.remove(players, 1)
table.remove(players, 2)
table.remove(players, 3)
end
Any help is appreciated

3 comments
Thanks alot i haven't tested this yet but i ensure this will work cause this looks trustworthy!
You should test it before accepting, everyone does mistakes, specially without testing
Oh okay