I made a script that changes all the characters of the players (models in workspace) to another model so the player moves the dirrection the model is moving. That works perfectly fine now I want the player's model to move from that model back to workspace when the player presses space but it doesn't work. I tried it both in game and in roblox studio solo. It is a local script located in the player starter script.
local localplayername = game.Players.LocalPlayer.Name
local m = game.Players.LocalPlayer:GetMouse()
db = true
m.KeyDown:connect(function(k)
if k == "32" then
if db == true then
for _, descendant in pairs(game.Workspace.FlightModel:GetDescendants())do
if descendant:IsA("Model") then
if descendant.Name == localplayername then
descendant.Parent = game.Workspace
end
end
end
end
end
end)

1 comment
KeyDown is deprecated, do not use it in new work.