Alright, so I've tried a lot of things, like basing the debounce off of a brick's color, which failed, and eventually, I came to BoolValues. I set up my script like this:
local enabled = true script.Parent.Touched:Connect(function(het) if het.Parent.Name == "Can" and enabled then local char = het.Parent.Parent local PlayerWhoClicked = game.Players:GetPlayerFromCharacter(char) PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Font = "SourceSans" PlayerWhoClicked.PlayerGui.TalkGui.Frame.Visible = true PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = "You watered the Flower." wait(3) PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = "Go tell ParentFigure!" wait(1) PlayerWhoClicked.PlayerGui.TalkGui.Frame.Visible = false game.Workspace.Flower.Watered == true -- Watered is the bool. end end)
the receiving side of the script would be this:
function onClicked(PlayerWhoClicked) PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Font = "SourceSans" PlayerWhoClicked.PlayerGui.TalkGui.Frame.Visible = true local name = PlayerWhoClicked.Name if workspace.Flower.Watered == true then PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = "You watered the plant?" wait(2) PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = " " PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = "Oh, aren't you the greatest!" wait(3) PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = "Well, I guess you should be going." wait(3) PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = "Bye! Don't forget to visit from time to time..." wait(3) PlayerWhoClicked.PlayerGui.TalkGui.Frame.Visible = false else PlayerWhoClicked.PlayerGui.TalkGui.Frame.TextLabel.Text = "Water the plant, " .. name wait(1) PlayerWhoClicked.PlayerGui.TalkGui.Frame.Visible = false script.Parent.ClickDetector.MouseClick:connect(onClicked)
and when I go through the steps to get to the final dialogue, this error happens.
18:17:54.647 - Watered is not a valid member of Model
I've tried and tried, but it won't work. Any ideas why?
It seems you are trying to check the value of a BoolValue, in this case you need to do
game.Workspace.Flower.Watered.Value == true
add '.Value' to access the actual value of the boolean
also, if you are trying to change the value of the bool, only use one '='