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

Why isn't this changing the boolvalue to true?

Asked by 4 years ago
Edited 4 years ago

So for some reason, it isn't changing the TR boolvalue anyone know why?

wait(5)
local player = game.Players.LocalPlayer
local char = player.Character
local IsOwner = char.Owner
local IsOwnerFriend = char.OwnerFriend1
local IsOwnerFriend2 = char.OwnerFriend2
local IsOwnerFriend3 = char.OwnerFriend3
local Msettings = script.Parent.Parent.Settings
local TR = game.ReplicatedStorage.TimeReset.Value
local min = game.ReplicatedStorage.Min.Value

function leftClick()
    print("Left mouse click")
    if player == IsOwner.Value or IsOwnerFriend.Value or IsOwnerFriend2.Value or IsOwnerFriend3.Value then 
    TR = true
    else
     print("Not Owner OR Friend Of Owner")
        end
    end
script.Parent.MouseButton1Click:Connect(leftClick)

1 answer

Log in to vote
2
Answered by
Nanomatics 1160 Moderation Voter
4 years ago

When you refer to a numbervalue, intvalue, stringvalue, etc.. and are trying to change it.

DO NOT assign a variable to it's value, and then try to change it, because then you are trying to change that variable, not the actual value.

Basically what you need to do to fix that is to make

local TR = game.ReplicatedStorage.TimeReset

And then when assigning it make it

TR.Value = true

Hope this helps. If you have any questions please let me know.

0
This is why we don’t use Value Objects Ziffixture 6913 — 4y
0
oh... Wow I should have known thank you :) dradon08777 17 — 4y
Ad

Answer this question