I'm currently making a jojo game but when I finish the toggle stand the stand won't follow me
main script
local rp = game:GetService("ReplicatedStorage")
local stand = rp:WaitForChild("Stand")
stand.OnServerEvent:Connect(function(player,active)
if active == false then
local char = player.Character
local hum = char:WaitForChild("HumanoidRootPart")
local Folder = Instance.new("Folder",workspace)
Folder.Name = player.Name.." stand"
local myStand = script:WaitForChild("The World"):Clone()
myStand.Parent = Folder
myStand:WaitForChild("HuamnoidRootPart").CFrame = hum.CFrame * CFrame.new(2,0,2)
local anim = myStand:WaitForChild("Animation")
local idle = anim:LoadAnimation(script:WaitForChild("Idle"))
idle:Play()
local bodyPos = Instance.new("BodyPosition", myStand)
bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local bodyGyro = Instance.new("BodyGyro", myStand)
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bodyGyro.Parent = myStand.HumanoidRootPart
while wait() do
bodyPos.Position = hum.Position + Vector3.new(2, 2, 3)
bodyGyro.CFrame = hum.CFrame
end
end
end)
stand.OnServerEvent:Connect(function(player,active)
if active == true then
local char = player.Character
local hum = char:WaitForChild("HumanoidRootPart")
local myStand = workspace:WaitForChild(player.Name.." stand")
myStand:Destroy()
stand:FireClient(player)
end
end)
local script
local plr = game.Players.LocalPlayer
local rp = game:GetService("ReplicatedStorage")
local stand = rp:WaitForChild("Stand")
local UIS =game:GetService("UserInputService")
local debounce = false
local active = false
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then
return
elseif input.KeyCode == Enum.KeyCode.Q then
if debounce == false and active == false then
debounce = true
stand:FireServer(active)
end
end
end)
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then
return
elseif input.KeyCode == Enum.KeyCode.Q then
if debounce == true and active == false then
active = true
stand:FireServer(active)
end
end
end)
stand.OnClientEvent:Connect(function()
wait(1)
debounce=false
active = false
end)

1 comment
What's the client script