I changed the parent of all the players into a model called FlightModel so the player would move the direction the model is moving. That works perfectly, now I want a local script located in Player Character scripts to detect when a player clicks the space button so It moves the location of the player's character from the model to workspace to make it not move with the model. But the script didn't work so I removed the Key pressed event and tried this instead. It still didn't work in game and in roblox studio

wait(65)
for _, descendant in pairs(game.Workspace.FlightModel:GetDescendants())do
	if descendant.Name == game.Players.LocalPlayer.Name then
		descendant.Parent = game.Workspace
	end	
end

this script moves the player's character to the model

for _, player in pairs(game.Players:GetPlayers())do
	player.Character.HumanoidRootPart.Anchored = true
	player.Character.HumanoidRootPart.CFrame = 	game.Workspace.FlightModel.PlayerHolder.CFrame 
	player.Character.Parent = game.Workspace.FlightModel
end

2 comments

0

Post the full code.

0

done