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

I made a local script when if the frame be visible and humanoid.died but not working??

Asked by 4 years ago
Edited 4 years ago
script.Parent.Humanoid.Died:Connect(function()
    if game.Players.LocalPlayer.PlayerGui.Quest.After.Visible == true then
    game.StarterPlayer.clevel.Value = game.StarterPlayer.clevel.Value + 1
    end
end)

i made when npc died and frame visible then the int value + 1

This is the script this is a local script there is no errors

clevel is the int value after is the frame

but not works

2 answers

Log in to vote
0
Answered by
JesseSong 3916 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Make sure you've put your script in one of these:

A Player’s Backpack, such as a child of a Tool A Player’s character model A Player’s PlayerGui A Player’s PlayerScripts. The ReplicatedFirst service

while true do
wait (1)
script.Parent.Humanoid.Died:Connect(function()
    if game.Players.LocalPlayer.PlayerGui.Quest.After.Visible == true then
    game.StarterPlayer.clevel.Value = game.StarterPlayer.clevel.Value + 1
    end
end)
0
its worked with your way but its not repeating i am saying if now i kill the npc the value will be +1 but if i do it again not working why TheGreenGaming886 2 — 4y
0
and i add while wait(1) but it gives a random number not + 1 why TheGreenGaming886 2 — 4y
0
hi i do copy and paste your script but it still gives an random number not +1 why??? TheGreenGaming886 2 — 4y
Ad
Log in to vote
0
Answered by
epicnt 13
4 years ago
Edited 4 years ago

Try this.

okValue = nil

if game.StarterPlayer.clevel.Value > 1 and game.StarterPlayer.clevel.Value ~= okValue  then
okValue = game.StarterPlayer.clevel.Value
game.StarterPlayer.clevel.Value = 1
end

local Killing = false

while true do
   wait (1)
    script.Parent.Humanoid.Died:Connect(function()
         Killing = true
     if game.Players.LocalPlayer.PlayerGui.Quest.After.Visible  == true and game.StarterPlayer.clevel.Value = okValue then
     game.StarterPlayer.clevel.Value = game.StarterPlayer.clevel.Value + 1
         Killing = false
    end
end)

If it doesn't work tell me, I'll edit it.

Answer this question