So, made a spinner script and obv did all the other things to make it spin. But I wanted to add some lives and I've coded it like this but for some reason it doesn't work.
--Variables-- local Brick = script.Parent --End-- --Code-- local function PlayerTouched(Part) local Parent = Part.Parent if game.Players:GetPlayerFromCharacter(Parent) then Parent.Humanoid.Health = 90 if workspace.spinner.Lives.BillboardGui.TextLabel.Text = "Lives: 10" then workspace.spinner.Lives.BillboardGui.TextLabel.Text = "Lives: 9" end end end Brick.Touched:connect(PlayerTouched) --End--
I haven't completed the code just tested if the code worked with just that but it didn't which is why I'm posting. Does anyone know how to fix this? Also, I'm new at lua so please try to keep it simple
When using the if statement you need to use a relational operator, so this can be easily fixed by just making line 10 into:
if workspace.spinner.Lives.BillboardGui.TextLabel.Text == "Lives: 10"