I have just solved this by removing the folder "Buildings" and directly cloning the model from replicated storage. While the script is still buggy, I think I can fix the rest from here.

Recently, I have been working on a tool that will summon a horse for your player to ride. It works fine once, but if you dismiss your horse and try to summon it again with the tool, It doesn't work. I figured it might have had something to do with the input not going through, so I put a print script inside, but after testing I found that is not the case. I also figured if I got a new tool it would work but once again, that wasn't the case and the new tool didn't work.

I have tried looking up how to fix this, but I couldn't find anything on cloning NPC's via a tool, so if anyone could help me out, here is the script for the tool;

local Tool = script.Parent
local player = script.Parent.Parent.Parent

script.Parent.Activated:Connect(function()
print("Select Triggered")
if player.leaderstats.Mount.Value == 0 then do	
local Build = game.ReplicatedStorage.Buildings:FindFirstChild(Tool.Model.Value):Clone()
Build.Parent = game.Workspace	
workspace.BlankMount.PrimaryPart = workspace.BlankMount.HumanoidRootPart
Build:SetPrimaryPartCFrame(Tool.Parent.HumanoidRootPart.CFrame)
Tool.Handle.Summon:Play()
player.leaderstats.Mount.Value = 1
		end
	end
end)

Also, if your wondering about the Mount stat, that is supposed to prevent the player from summoning another horse while mounted. There is a script inside the horse where if the player dismounts it is set back to 0. Also, the script is a normal script, not a local one.

sorry if this question is formatted poorly, I am new to scripting helpers.

2 comments

0

Why are you storing private variables in leaderstats?

0

I figured it would be easier. Also, there will be different mounts besides a horse, I figured a stat would be easier than making separate variables.