Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

(solved) Why does my stand does not follow me?

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

0

What's the client script

1 answer

ok the problem was in the 1st script you didn't need to add the gyro position and such

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.PrimaryPart.CFrame = hum.CFrame * CFrame.new(2,0,2)
		myStand.Summon:Play()
		
		local anim = myStand.Idle
		local idle = myStand.Humanoid:LoadAnimation(anim)
		idle:Play()		
		
		while wait(0) do
			myStand.PrimaryPart.CFrame = hum.CFrame * CFrame.new(2,0,2)
			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.UnSummon:Play()
		myStand:Destroy()
		
		stand:FireClient(player)
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.