so, when the player touches a part, a gui will appear and will display how many doors player has opened. But it doesn’t update it and always display 0.
help…
local script :
event.OnClientEvent:Connect(function(checked, total, text)
local message = text .. "\n" .. checked .. "/" .. total
local frame = script.Parent:WaitForChild("Frame")
local text = frame:WaitForChild("Text")
frame:TweenPosition(UDim2.new(0.883, 0, 0.5, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.3, false)
text.Text = message
end)
script :
script.Parent.Touched:Connect(function()
event:FireAllClients(valueChecks.Value, valueTotal.Value, "Open all doors!")
end)
Have you printed out the values on the server sided script to check the values before firing them? If not then the issue may just be with the Values not being updated beforehand.
Honestly not sure, but it probably isn’t great that you use an argument’s name as a new variable, “text” (With a lowercase ‘t’) I don’t think that’s generally a good idea.
oh nevermind i have figured it out : i have to put :GetPropertyChangedSignal
script.Parent.Touched:Connect(function()
local function changed()
event:FireAllClients(valueChecks.Value, valueTotal.Value, "Open all doors!")
end
changed()
valueChecks:GetPropertyChangedSignal("Value"):Connect(function()
changed()
end)
end)
You need to touch the part again most likely. If you touch the part that shows the gui, you would be able to see your changes reflected. I think you would like it if it updated automatically though, so in order to do that, use
local function OnValueChanged()
(update gui)
end