I’m trying to make a king of the hill aspect in my simulator game, but it doesn’t seem to be working.
My script is set up in a way that there are two stored values - one containing the Hill’s owner, and the other containing the max value that a player must beat. It should be working.
My script is minimalistic and basic; I’ll provide the script, screenshots, and the layout of objects in my explorer.
local MaxPower = script.Parent.MaxPower
local OwnerName = script.Parent.Owner
local BillBoard = script.Parent.Parent.KothBuildboard
local Debounce = false
script.Parent.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
if Debounce == false then
Debounce = true
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
if Humanoid.JumpPower > MaxPower.Value then
MaxPower.Value = Humanoid.JumpPower
if OwnerName.Value == "No" then
else
game.Players:FindFirstChild(OwnerName.Value).OtherValues.Multiplier.Value -= 3
if game.Players:FindFirstChild(OwnerName.Value).OtherValues.Multiplier.Value == 0 then
game.Players:FindFirstChild(OwnerName.Value).OtherValues.Multiplier.Value = 1
end
OwnerName.Value = Player.Name
BillBoard.BillboardGui.TextLabel.Text = Player.Name
if Player.OtherValues.Multiplier.Value == 1 then
Player.OtherValues.Multiplier.Value = 3
else
Player.OtherValues.Multiplier.Value += 3
end
end
end
wait(1)
Debounce = false
end
end
end)