Basically, I have been working on a mining system, and I tried multiple fixes on the server script, but for some odd reason, the script will only work on a local script.
-- \\ Get-Services Variables // --
local RS = game:GetService("ReplicatedStorage")
local CS = game:GetService("CollectionService")
local SP = game:GetService("StarterPack")
-- \\ RS Variables // --
local Mine = script.Parent.Minin
-- \\ Tools // --
local HEAD = SP.Pickaxe["Meshes/Pick axe_Cube"]
-- \\ Functions // --
Mine.OnServerEvent:Connect(function()
print("Well it fried")
HEAD.Touched:Connect(function(Hit)
print("Why would I hate?")
print(Hit.Name)
end)
end)
--[[if CS:HasTag(Hit, "Ores") then
print("Ores")
local HP = Hit.Parent:GetAttribute("HP").Value
print("StillWorking")
print("Possibly still working")
Hit.Parent:SetAttribute("HP", HP-1)
print("Might be broken here")
print(HP)
if HP <= 0 then
print("RockBroken")
end
else
print("No tag, LOL")
end]]
This is the server script, that can be moved to the local script, which worked.
-- \\ Player-Related Variables // --
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HUM = Character:WaitForChild("Humanoid")
local DB = false
-- \\ Tool-Variable // --
local Tool = script.Parent
-- \\ Anim-Related Variables // --
local Idle = script.Parent.Idle
local IdleAnim = HUM.Animator:LoadAnimation(Idle)
local Mining = script.Parent.Mining
local MineAnim = HUM.Animator:LoadAnimation(Mining)
-- \\ Get-Service Variables // --
local RS = game:GetService("ReplicatedStorage")
-- \\ Event Variables // --
local Mine = script.Parent.Minin
local Head = script.Parent["Meshes/Pick axe_Cube"]
-- \\ Edits // --
Tool.Grip = CFrame.fromEulerAnglesXYZ(260, 55, 0)
--[[Tool.Equipped:Connect(function()
IdleAnim:Play()
IdleAnim.Looped = true
end)
Tool.Unequipped:Connect(function()
IdleAnim:Stop()
IdleAnim.Looped = false
end)]]
Tool.Activated:Connect(function()
if DB == false then
DB = true
MineAnim:Play()
Mine:FireServer()
print("Can't relate tho")
task.wait(2)
DB = false
end
end)
On the local script, I can post my server script under the fireserver part of the script, and it will work, printing out what I need it to print out.