Why isn't my model spawn script working?

Hello, I am currently trying to make a button that when pressed spawns a model in front of me but I am having trouble figuring out why the script that is in the model is not working when I spawn the it. I could really use some help.

script in model:


function slowDown(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		humanoid.WalkSpeed = 5 
	end
end

function ResetSpeed(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		humanoid.WalkSpeed = 16
	end
end

Part.Touched:Connect(slowDown)
Part.TouchEnded:Connect(ResetSpeed)

script in button:

script.Parent.MouseButton1Click:Connect(function()
	local HRP = game.Players.LocalPlayer.Character.HumanoidRootPart
	local model = game.ReplicatedStorage.Yrden:Clone()
	local distance = 10 -- distance between the model and the character
	local pos = HRP.Position + (HRP.CFrame.LookVector)*distance
	
	model.Parent = workspace
	model:MoveTo(pos)
	wait(10)
	game.Workspace.Yrden:Destroy()
end)

Hey if you could edit your post and format the code using ``` at the beginning and endings it would make it a lot easier to read. Could you also provide script outputs and a better explanation? Is that video your desired outcome or is that the issue?

the video is the issue not the desired outcome

Whats the entire script in the model? Oh, and in the button script, instead of using this

game.Workspace.Yrden:Destroy()

You should use this:

model:Destroy()

If there are multiple models with the same parent, the script doesnt know what to choose so its picking a random model.

script on model is at server side right ? and u trying move the model in client side, so i think thats why that things doesnt work

local script

script.Parent.MouseButton1Click:Connect(function()
 game.ReplicatedStorage.RemoteEvent:FireServer()
end)

at serverscript

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
	local HRP = player.Character.HumanoidRootPart
	local model = game.ReplicatedStorage.Yrden:Clone()
	local distance = 10 -- distance between the model and the character
	local pos = HRP.Position + (HRP.CFrame.LookVector)*distance

	model.Parent = workspace
	model.PrimaryPart.CFrame = CFrame.new(HRP.Position + HRP.CFrame.LookVector * distance)
	game:GetService("Debris"):AddItem(game.Workspace.Yrden,10)
end)

I wouldn’t recommend using :MoveTo(), Instead I would just directly set the models CFrame or position using Vector3.