Not sure if you have seen this horse, many groups have this Horse tool, but… I have no idea how to set it up, since it’s not working properly, if you know how to solve this, please tell me.
If you need any more information, please tell me, it can be the horse’s Scripts, Animations, and Seats… (The horse does work when it’s put on the workspace, but without the tool)
In order for this to work you use Remote Events.
1.) To do this you need to add a Remote Event to Replicated Storage(name it RemoteEvent).
2.) In the tool script add the code below to fire the remote event with the name of the animal and the mouse position.
local remote = game.ReplicatedStorage.RemoteEvent
local animal = script.Parent.Name
local comn = script.Parent
function onEquippedLocal(mouse)
if mouse == nil then
print("Mouse not found")
return
end
mouse.Icon = ""
mouse.Button1Down:connect(function()
remote:FireServer(animal, mouse.hit.p + Vector3.new(0,1,0))
end)
end
comn.Equipped:connect(onEquippedLocal)
3.) Create a Script in ServerScriptService that contains the code to run when the event is fired.
local remote = game.ReplicatedStorage.RemoteEvent
function onButton1Down(plr, animal, Pos)
if game.Workspace:FindFirstChild(plr.Name.."s".. " " .. animal) then
game.Workspace[plr.Name.."s".. " " .. animal]:remove()
local model = game.Lighting.Animals[animal]:clone()
model.Parent = game.Workspace
model.Name = plr.Name.."s".. " " .. animal
model:MakeJoints()
model:MoveTo(Pos)
else
local model = game.Lighting.Animals[animal]:clone()
model.Parent = game.Workspace
model.Name = plr.Name.."s".. " " .. animal
model:MakeJoints()
model:MoveTo(Pos)
end
end
remote.OnServerEvent:Connect(function(plr, animal, Pos)
onButton1Down(plr, animal, Pos)
end)
4.) Test the place. If it still does not work download the Rbxl file here. Horse Tool.rbxl (109.5 KB) Hopefully this answered your question.
If you want to completely Destroy it in the local script after you fire the event you can do
script.Parent:Destroy()
But if you want to give them the tool back you would have to clone it and move it back to the players backpack. Also you may want to go to the tool and disable CanBeDropped if not the player can click Backspace and the tool disappears.