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

Script says that my leaderstats (Traven) is 1 but it's 3?

https://www.youtube.com/watch?v=R8W6T4wMSl4

my script,

Script type: normal script because it's a 1 player game.

local tra = game.Players.LocalPlayer.leaderstats.traven.Value
local human = game.Players.LocalPlayer.Name
script.Parent.MouseButton1Click:Connect(function()
if tra == 1 then
		print("1")
end
if tra == 2 then
game.Lighting["2"].Parent = game.Workspace
wait(0.01)
game.Workspace["1"].Parent = game.Lighting
end
	if tra == 3 then
		game.Lighting["3"].Parent = game.Workspace
		wait(0.01)
		game.Workspace["1"].Parent = game.Lighting
	end
	if tra == 4 then
		game.Lighting["4"].Parent = game.Workspace
		wait(0.01)
		game.Workspace["1"].Parent = game.Lighting
	end
	if tra == 5 then
		game.Lighting["5"].Parent = game.Workspace
		wait(0.01)
		game.Workspace["1"].Parent = game.Lighting
	end
end)

it does the same ingame too, not just studio.

5 comments

0

I don't understand ????

0

do you have any other scripts that is using the traven too?

0

yes, at the end of each level is a button that you press where traven turns to 1,2,3,4,5 depending on the level

0

You say that's a normal script, but normal scripts cant use LocalPlayer, only local scripts can use LocalPlayer. I don't really understand your question. Just so you know, using local scripts sets things on the client's sides, and normal scripts sets things on the server's side (If that makes sense).

0

But what is the point of it being client side if it's a 1 player game?

4 answers

I am not too sure that this will solve what you need,

Maybe try

if tra == 1 then
        print("1")
end
if tra == 2 then
game.Lighting["2"].Parent = game.Workspace
wait(0.01)
game.Workspace["1"].Parent = game.Lighting
print("2")
end
    if tra == 3 then
        game.Lighting["3"].Parent = game.Workspace
        wait(0.01)
        game.Workspace["1"].Parent = game.Lighting
        print("3")
    end
    if tra == 4 then
        game.Lighting["4"].Parent = game.Workspace
        wait(0.01)
        game.Workspace["1"].Parent = game.Lighting
        print("4")
    end
    if tra == 5 then
        game.Lighting["5"].Parent = game.Workspace
        wait(0.01)
        game.Workspace["1"].Parent = game.Lighting
        print("5")
    end
end)

1 comment

0

Nope

Hey guys i got it working, i just replaced tra with game.Players.LocalPlayer.leaderstats.traven.Value, im not the best with scripting but i think it was because it was only looking at traven once and not "refreshing"

Hey guys i got it working, i just replaced tra with game.Players.LocalPlayer.leaderstats.traven.Value, im not the best with scripting but i think it was because it was only looking at traven once and not "refreshing"

hey you! have you ever heard of enes? if you are in trouble, better call enes!

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