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

Why won't this change the IntValue?

Asked by 10 years ago

[Edited]

Background Information: FilteringEnabled is on. I'm using a RemoveEvent to send Data between the Server and the Client. The number gets transferred, but the IntValue value doesn't change. The IntValue is in the Gui with the Client Localscript. It does not work with FilteringEnabled off. The Gui does show up, so it is being called. It is NOT an error with the DoorStop. The '.Value' thing does not affect the script at all.

Okay, so I have a brick, so that when you do indeed touch it, it sends a Client event to the player, that part works. However, the number transfers, but the IntValue does NOT change. Whether it's from me referencing the IntValue wrong, or it's an issue with it in general.

My script is below:

event = game.ReplicatedStorage.OpenDoors

DoorVal = script.Parent.DoorValue

event.OnClientEvent:connect(function(...)
    local tuple = {...}
    if tuple[1] == "Door" then
        DoorVal.Value = tuple[2]
        script.Parent.Label.Visible = true
    else
        if tuple[1] == "DoorStop" then
            DoorVal.Value = 0
            script.Parent.Label.Visible = false
        end
    end
end)

This is where the error resides, because I've manually changed the value (I.E: Changing the value, saving the game and going in game/Changing it then Play Solo.) and it worked. Please help, and thanks in advance.

2 answers

Log in to vote
1
Answered by
SirNoobly 165
10 years ago

A very common error when working with Values, DoorVal = script.Parent.DoorValue.Value is just a number not the actual Value Property, you would have to do:

DoorVal = script.Parent.DoorValue


DoorVal.Value = tuple[2]
DoorVal.Value = 0
0
It still didn't work. LennyTheLucario 45 — 10y
Ad
Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

DoorVal is just a variable. It doesn't do special things like remember where it came from. Changing it means it's something else. Initially setting that variable to script.Parent.DoorValue.Value is the only time that the IntValue is ever being referenced.

0
But the issue is, if I do take away the .Value from the variable and add it every time I reference it, it still doesn't work. LennyTheLucario 45 — 10y
0
you should be using elseif and not "else if" 1waffle1 2908 — 10y
0
That fixed another error of mine where it would spaz out every so often, but still didn't work. Thanks for helping, though. LennyTheLucario 45 — 10y

Answer this question