(The Hammer is a tool) and also after I try to use the hammer I can't punch it??
The codes:
Local script (request to break glass) and checks if hammer or not
local remoteEv = game.ReplicatedStorage.RemoteEV.GlassOne local rem = game.ReplicatedStorage.RemoteEV.BreakGlassHammer deb = false workspace.Small_House.GlassOne.Touched:Connect(function(hit) if not deb then deb = true if hit.Parent:FindFirstChild("Hammer") then rem:FireServer() elseif hit.Parent:FindFirstChild("RightHand") then remoteEv:FireServer() wait(70) deb = false end end end)
Server script if the player has a hammer
local rem = game.ReplicatedStorage.RemoteEV.BreakGlassHammer local particle = workspace.Small_House.GlassOne.ParticleEmitter local Shatter = game.ReplicatedStorage.GlassOne.Shatter local Glass = workspace.Small_House:WaitForChild("GlassOne") local rem = game.ReplicatedStorage.RemoteEV:WaitForChild("BreakGlassHammer") local sound = workspace.Small_House.GlassOne.Glass_Break rem.OnServerEvent:Connect(function(player) wait(0.1) sound:Play() particle.Enabled = true wait(0.2) particle.Enabled = false Shatter.Parent = workspace Shatter.Anchored = true Glass.Parent = game.ReplicatedStorage.GlassOne wait(70) Shatter.Parent = game.ReplicatedStorage.GlassOne Glass.Parent = workspace end)
the other server script player has no hammer
local RemoteEv = game.ReplicatedStorage.RemoteEV:WaitForChild("GlassOne") local particle = workspace.Small_House.GlassOne.ParticleEmitter local Shatter = game.ReplicatedStorage.GlassOne.Shatter local Glass = workspace.Small_House:WaitForChild("GlassOne") local sound = workspace.Small_House.GlassOne.Glass_Break RemoteEv.OnServerEvent:Connect(function(player) wait(0.1) sound:Play() particle.Enabled = true wait(0.2) particle.Enabled = false Shatter.Parent = workspace Shatter.Anchored = true player.Character.Humanoid.Health = player.Character.Humanoid.Health -100 player.PlayerGui.DeathScreenGlass.Enabled = true Glass.Parent = game.ReplicatedStorage.GlassOne wait(70) Shatter.Parent = game.ReplicatedStorage.GlassOne Glass.Parent = workspace end)
idn what im doing wrong plz help