I've been trying to make a tool which allows you to mine rocks depending on the level etc. I made a remote function so the Variable of rockhit could go to the server side. I think it is not working because Mouse is something only used on the Client side, I could be wrong though.
Here is my script so far:
Client:
local Pickaxe = script.Parent
local PickaxeHitSound = script.Parent.PickaxeHit
local ToolBreakSound = script.Parent.ToolBreak
local Durability = script.Parent.Durability
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RemoteEvent = Pickaxe:WaitForChild("RemoteEvent")
local Debounce = true
local Delay = 1
function slash()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Pickaxe
end
Pickaxe.Activated:Connect(function()
if Debounce then
Debounce = false
slash()
if Mouse.Target.Name == "CoalRock" then
local rockhit = Mouse.Target.Parent
RemoteEvent:FireServer(rockhit)
elseif Mouse.Target.Name == "BronzeRock" then
print("Pickaxe too low level")
elseif Mouse.Target.Name == "GoldRock" then
print("Pickaxe too low level")
else
print("Error")
end
wait(Delay)
Debounce = true
end
end)
Server:
local Pickaxe = script.Parent
local RemoteEvent = Pickaxe:WaitForChild("RemoteEvent")
RemoteEvent.OnServerEvent:Connect(function(rockhit)
print(rockhit)
end)
If anybody could help me out that'd be really appreciated.

1 comment
Thank you so much it worked