Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When i use the hammer to break the glass it.?.. (ANSWERED)

Asked by 4 years ago
Edited by DeceptiveCaster 4 years ago

(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

0
Have you tried hit.Parent.Parent? DeceptiveCaster 3761 — 4y
0
umm no, on the hammer one? Freddan2006YT 88 — 4y
0
Oh wait Freddan2006YT 88 — 4y
0
Tahnkyou so much it worked lmao, i didn't even see that. Freddan2006YT 88 — 4y

Answer this question