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

Why isn't my elseif statement functioning properly?

Asked by 5 years ago

Hello!

I am wondering why my elseIf statement isn't working correctly. As, when the value is set at 0, it prints out Hi. However, when the value is set at 1, and I click on my gui. It does not print anything at all! I would appreciate some help. As I have spend an hour on this and can't seem to figure it out.

local Gui = script.Parent.Picture

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Event = ReplicatedStorage:WaitForChild("Events").SaveDataReturn



Gui.MouseButton1Down:Connect(function()

Event:InvokeServer()



local Value = ReplicatedStorage.Return.SaveData



if Value == 0 then

print("Hi")

elseif Value == 1 then

print("Tween")

end





end)
0
I think on line 15 you might want to change SaveData to SaveData.Value see if that fixes it, or try making it into 2 if statements AnonymousDeveloper13 22 — 5y

1 answer

Log in to vote
0
Answered by
ben0h555 417 Moderation Voter
5 years ago
Edited 5 years ago

On line 15 you have put

local Value = ReplicatedStorage.Return.SaveData

If ReplicatedStorage.Return.SaveData is a Value object then instead of that you must place:

local Value = ReplicatedStorage.Return.SaveData.Value

If its not that, then please give information on what exactly is ReplicatedStorage.Return.SaveData so I may help you.

Ad

Answer this question