I’m was trying to use an if statement to check for a value but on the first elseif it does not call that I checked and my value was equal to 1 can anyone help.
Thanks!
if Player.Trails.GrayTrail.Value == 0 then
Status.Text = "Buy"
Button.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
TrailBought:FireServer()
PlusOne:FireServer()
wait(0.1)
debounce = false
end
end)
elseif Player.Trails.GrayTrail.Value == 1 then
Status.Text = "Equip"
Button.MouseButton1Click:Connect(function(player)
local char = player.Character
local attachment0 = Instance.new("Attachment")
attachment0.Name = "TrailAttachment0"
attachment0.Parent = char.Head
local attachment1 = Instance.new("Attachment")
attachment1.Name = "TrailAttachment1"
attachment1.Parent = char.HumanoidRootPart
Trail.Attachment0 = attachment0
Trail.Attachment1 = attachment1
Trail.Parent = char.Head
end)
else
Status.Text = "Equipped"
end
local Button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Trail = ReplicatedStorage.Trails.Gray:Clone()
local LPlayer = game:GetService("Players").LocalPlayer
local Price = Button.Price
local Status = Button.Status
local Player = Button.Parent.Parent.Parent.Parent
local TrailBought = ReplicatedStorage.BuysTrail
local debounce = false
local PlusOne = ReplicatedStorage.PlusOneGray
local Button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Trail = ReplicatedStorage.Trails.Gray:Clone()
local LPlayer = game:GetService("Players").LocalPlayer
local Price = Button.Price
local Status = Button.Status
local Player = Button.Parent.Parent.Parent.Parent
local TrailBought = ReplicatedStorage.BuysTrail
local debounce = false
local PlusOne = ReplicatedStorage.PlusOneGray
if Player.Trails.GrayTrail.Value == 0 then
Status.Text = "Buy"
Button.MouseButton1Click:Connect(function()
if not debounce then
debounce = true
TrailBought:FireServer()
PlusOne:FireServer()
wait(0.1)
debounce = false
end
end)
elseif Player.Trails.GrayTrail.Value == 1 then
Status.Text = "Equip"
Button.MouseButton1Click:Connect(function(player)
local char = player.Character
local attachment0 = Instance.new("Attachment")
attachment0.Name = "TrailAttachment0"
attachment0.Parent = char.Head
local attachment1 = Instance.new("Attachment")
attachment1.Name = "TrailAttachment1"
attachment1.Parent = char.HumanoidRootPart
Trail.Attachment0 = attachment0
Trail.Attachment1 = attachment1
Trail.Parent = char.Head
end)
else
Status.Text = "Equipped"
end
Try and check for spelling errors within the Player.Trails.GrayTrail.Value? It might be because you accidentally might’ve made a spelling error. This error is confusing towards me.
a.k.a GrayTrail.Name = "Gray Trail" which in this case would be Gray_Trail