Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

3 comments

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

0

and i add while wait(1) but it gives a random number not + 1 why

0

hi i do copy and paste your script but it still gives an random number not +1 why???

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.