Alright, so I'm not very good with RemoteEvents/Functions, so I don't really know what I'm doing here. Simply enough, the trunk isnt unanchoring in online mode, but in test mode it works fine. Any help?
--ServerSide
local plrs = game:GetService("Players")
local repStorage = game:GetService("ReplicatedStorage")
local treeChoppingRemote = repStorage:WaitForChild("TreeChopping")
treeChoppingRemote:FireAllClients()
--Local
local repStorage = game:GetService("ReplicatedStorage")
local treeChoppingRemote = repStorage:WaitForChild("TreeChopping")
local plr = game:GetService("Players").LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local mouse = plr:GetMouse()
local axeHead = script.Parent.Axe.Head
local axe = script.Parent.Axe
local treeDist = 10
local treeHits = 0
local db = false
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://1411773594"
animTrack = char.Humanoid:LoadAnimation(animation)
axe.Equipped:Connect(function()
axe.Activated:Connect(function()
if mouse.Target.Parent.Name == "Pine Tree" and mouse.Target ~= nil and mouse.Target.Parent.Trunk.Anchored == true then
if (mouse.Target.Parent.Root.Position - char.HumanoidRootPart.Position).magnitude < treeDist then
if not db then
db = true
animTrack:Play()
wait(.6)
treeHits = treeHits + 1
db = false
if treeHits >= 3 then
local function chop()
mouse.Target.Parent.Leaves.Anchored = false
mouse.Target.Parent.Trunk.Anchored = false
end
print("Test")
treeHits = 0
treeChoppingRemote.OnClientEvent:Connect(chop)
end
end
end
end
end)
end)

4 comments
Why are you unanchoring in the client is it suppost to be local or does everyone need to see it.
Everyone needs to see it, but that's what I'm trying to do.
Why not just fire the unanchor part through the server, instead of the client?
Not sure how I would do that, because the player hits the tree, causing it to fall.