Hello!

I am currently making a survival game where you can place a campfire. However, if you were to place the campfire under a model or yourself, it would clone it on top of instead of the ground.

How do I go to fix this?

I have a LocalScript inside my tool:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("CampfireRemote")
local Player = game:GetService("Players").LocalPlayer
local Cursor = Player:GetMouse()
local CampfireTool = script.Parent

CampfireTool.Activated:Connect(function(input, click)
    Remote:FireServer(Cursor.Hit.Position)
    CampfireTool:Destroy()
end)

Along with a RemoteEvent in ReplicatedStorage named CampfireRemove and aServerScript in ServerScriptService:

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Campfire = ServerStorage:WaitForChild("Campfire")

local Remote = ReplicatedStorage:WaitForChild("CampfireRemote")

Remote.OnServerEvent:Connect(function(player, position)
    local ClonedCampfire = Campfire:Clone()
    ClonedCampfire.Parent = game:GetService("Workspace")
    ClonedCampfire:MoveTo(position)
end)

The Campfire Model is inside ServerStorage and it gets cloned to Workspace

I do not know why the Campfire clones on top of another model. It also clones if the model has no collisions.

If I could get some help with this, it would be great.

Thanks!

1 comment

0

Use Mouse.TargetFilter.