I am currently making a teamwork game where one player is the balloon and one player is the holder, but I have a problem, when the balloon is created and the player is a part of it the balloons humanoidRootPart doesn’t move with input
Balloon creation script (server script): local plr = script.Parent.Parent.Parent.Parent
local button = script.Parent
local balloon = game.Workspace.BalloonChar
local balloonEvent = game.ReplicatedStorage.Remotes.ServerToClient.BecomeBalloon
button.MouseButton1Up:Connect(function()
local balloonClone = balloon:Clone()
local balloonHumanoid = balloonClone.Humanoid
local balloonHrp = balloonClone.HumanoidRootPart
local ownerID = balloonClone.OwnerID
balloonClone.Parent = game.Workspace
ownerID.Value = plr.UserId
balloonHumanoid:ChangeState(Enum.HumanoidStateType.Physics)
balloonHumanoid.PlatformStand = true
balloonHrp.CFrame = plr.Character.HumanoidRootPart.CFrame
plr.Character.HumanoidRootPart.Anchored = true
plr.Character.HumanoidRootPart.CFrame = balloonHrp.CFrame
balloonEvent:FireClient(plr, balloonClone)
--
end)
become balloon script (Client)
local uis = game:GetService(“UserInputService”)
local event = game.ReplicatedStorage.Remotes.ServerToClient.BecomeBalloon
local processEvent = game.ReplicatedStorage.Remotes.ClientToServer.Input
local camera = workspace.CurrentCamera
event.OnClientEvent:Connect(function(balloonClone)
print(“event”)
camera.CameraSubject = balloonClone.HumanoidRootPart
uis.InputBegan:Connect(function(input)
processEvent:FireServer(input.KeyCode)
end)
end)
userInput on the server (server script): local processEvent = game.ReplicatedStorage.Remotes.ClientToServer.Input
local balloon = script.Parent
local hrp = balloon.HumanoidRootPart
local force = 10
processEvent.OnServerEvent:Connect(function(plr, input)
– move the hrp forward when W is pressed backwards when S is pressed, etc
if input == Enum.KeyCode.W then
hrp.Velocity = hrp.CFrame.LookVector * force
elseif input == Enum.KeyCode.S then
hrp.Velocity = hrp.CFrame.LookVector * -force
elseif input == Enum.KeyCode.A then
hrp.Velocity = hrp.CFrame.RightVector * -force
elseif input == Enum.KeyCode.D then
hrp.Velocity = hrp.CFrame.RightVector * force
end
end)