So I have a variable called BoughtHouse. BoughtHouse = false right now.
But I need it to be accesable from another script in the workspace as well.
Use something called a BoolValue.
BoolValues are either true or false, now the script that I'm creating here is if the player does not own the house the player will get damaged.
Instance a boolvalue in the player like this;
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local BoughtHouse = Instance.new("BoolValue", leaderstats) BoughtHouse.Name = "BoughtHouse" end)
then you can access it from another script
script.Parent.Touched:Connect(function(hit) local Humanoid = hit.Parent:FindFirstChild("Humanoid") if (Humanoid ~= nil) then local Character = hit.Parent local Player = game.Players:GetPlayerFromCharacter(Character) if Player.leaderstats.BoughtHouse == false then Humanoid:TakeDamage(20) end end end)
or you can use modulescripts.