Im trying to make a part transparent when the part of a tool touched it with fireserver. Instead of it sending the part location or info, it sends the players name. Is there a way to fix this ?
local db = false
local hitdb = false
local anim
script.Parent.Activated:Connect(function()
if db == false then
db = true
script.Parent.rock.Touched:Connect(function(hit)
if hitdb == false then
if hit:FindFirstChild("InGameObject") and hit:FindFirstChild("InGameObject").Value == true then
game.ReplicatedStorage.Events.Tool_On_Hit:FireServer(hit.InGameObject.Parent)
hitdb = true
end
end
end)
anim:Play()
wait(1)
hitdb = false
db = false
end
end)
script.Parent.Equipped:Connect(function()
local hum = script.Parent.Parent.Humanoid
anim = hum:LoadAnimation(script.Parent:WaitForChild("Slash_Anim"))
end)
script.Parent.Unequipped:Connect(function()
if anim then
anim:Stop()
end
end)
local db, hitdb = false, false
local Player = game:GetService("Players").LocalPlayer
local hum = (Player.Character or Player.CharacterAdded:Wait()):WaitForChild("Humanoid")
local anim = hum:WaitForChild("Animator"):LoadAnimation(script.Parent:WaitForChild("Slash_Anim"))
script.Parent.Activated:Connect(function()
if not db then return end
db = true
anim:Play()
task.wait(1)
hitdb = false
db = false
end)
script.Parent.rock.Touched:Connect(function(hit)
local InGameObject = hit:FindFirstChild("InGameObject")
if hitdb or not InGameObject or not InGameObject.Value then return end
game:GetService("ReplicatedStorage").Events.Tool_On_Hit:FireServer(InGameObject.Parent)
hitdb = true
end)
script.Parent.Unequipped:Connect(function()
if anim then anim:Stop() end
end)
Server:
game.ReplicatedStorage.Events.Tool_On_Hit.OnServerEvent:Connect(function(Player, hit)
local InGameObject = hit and hit:FindFirstChild("InGameObject")
if not InGameObject or not InGameObject.Value then return end
hit.Transparency = 1
end)