Script 1
script.Parent.Head.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney then
local ownstycoon = cashmoney:FindFirstChild("OwnsTycoon")
if ownstycoon then
if ownstycoon.Value == false then
if script.Parent.Parent.Parent.Owner.Value == nil then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Humanoid.Health > 0 then
script.Parent.Parent.Parent.Owner.Value = player
ownstycoon.Value = true
script.Parent.Name = player.Name .. "'s Tycoon"
script.Parent.Head.Transparency = 0.6
script.Parent.Head.CanCollide = false
player.TeamColor = BrickColor.new(script.Parent.Parent.Parent.Name)
end
end
end
end
end
end
end
end)
Script 2
script.Parent.Head.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if script.Parent.Head.Transparency == 0.6 then
if player.Name ~= script.Parent.Parent.Parent.Owner.Value then
player.Character:FindFirstChild("Humanoid").Health = 0
end
end
end)
19:54:07.396 - Workspace.Tycoons.Bright blue.Gate.Touch to claim Ownership:6: attempt to index local 'player' (a nil value) 19:54:07.396 - Stack Begin 19:54:07.397 - Script 'Workspace.Tycoons.Bright blue.Gate.Touch to claim Ownership', Line 6
I have these 2 scripts inside a model. I am using Berezas tycoon kit, and the first script is his and the second is mine. I'm trying to get it so when a person who is not the owner walks into the door it will kill them, but this dosent work.

5 comments
This just kills everyone who enters it
Well then I guess no one's name is equal to the Owner.Value :P
i fixed it, but now it just lets everyone through again
nvm, it still kills the player. It definitely has an owner, cause I checked the workspace on server mode.
editted my answer with output