If statement for some reason not checking the string?

for some reason it doesn’t check the string even tho the print works and prints the string? the string is set correctly and the server prints it but if statement doesn’t work?
i set the string value on client and the server receives it properly but either im formating the if statement wrong or there is something wrong with it.


local rs = game:GetService("ReplicatedStorage")

local ts = game:GetService("TweenService")
local event = rs.RitualEvent
local tweeninfo = TweenInfo.new(
	0.4,
	Enum.EasingStyle.Cubic,
	Enum.EasingDirection.Out,
	0
)

local derbis = game:GetService("Debris")

event.OnServerEvent:Connect(function(player,god,model)
	print(god)
	local marking = Instance.new("Decal")
	marking.Transparency = 1
	marking.ZIndex = 2
	marking.Parent = model
	marking.Face = Enum.NormalId.Top
	local tween = ts:Create(marking,tweeninfo, {Transparency = 0})
	local Distance = (model.Position - player.CharacterAdded:Wait().HumanoidRootPart.Position).Magnitude
	derbis:AddItem(marking,5)
	if god == "Hope" then
		player.Character.Affinity.Hope.Value = player.Character.Affinity.Hope.Value + 1
		marking.Texture = "rbxassetid://12895398403"
		tween:Play()
	end
	if god == "Love" then
		player.Character.Affinity.Love.Value = player.Character.Affinity.Love.Value + 1
		marking.Texture = "rbxassetid://12897510489"
		tween:Play()
	end
	if god == "Destruction" then
		player.Character.Affinity.Destruction.Value = player.Character.Affinity.Destruction.Value + 1
		marking.Texture = "rbxassetid://12897507045"
		tween:Play()
	end
end)


This may cause the yielding, you don’t need to do that unless the character is not loaded.

now I know that the topic has been solved already, but i really recommend wrapping it in an “if, elseif,else” statement, like so:

if god == "Hope" then
--code
elseif god == "Love" then
--code
elseif god == "Destruction" then
--code
end

i suggest this because i had times when i set up 3 related if statement like you did, and even when it only matched one instance, 2 or 3 if statements activated. not an issue with if elseif though

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.