This script works in play solo, but not in server mode :L Please help I'm not sure what's wrong with it... Thanks!
script.Parent.Touched:connect(function(hit) owned = script.Parent.Parent.Parent.Owned.Value player = game.Players:GetPlayerFromCharacter(hit.Parent) local found = hit.Parent:FindFirstChild("Humanoid") if owned == false and player.Cash.Value >=1000 and player.HasHouse.Value == false then player.Cash.Value = player.Cash.Value-1000 player.PlayerGui.Menu.Frame.House1.Visible = true player.HasHouse.Value = true script.Parent.Parent.Parent.Owned.Value = true script.Parent.Parent.Parent.OwnedBy.Value = hit.Parent.Name script.Parent.Transparency = 1 script.Parent.CanCollide = false else end end)
You actually didn't test if it was a character that hit the brick. I did a through test run and set up everything, so this script should be working!
owned = script.Parent.Parent.Parent.Owned.Value script.Parent.Touched:connect(function(hit) player = game.Players:GetPlayerFromCharacter(hit.Parent) if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then --You were missing this. Then we proceed to checking if they have the requirements. if owned == false and player.Cash.Value >=1000 and player.HasHouse.Value == false then player.Cash.Value = player.Cash.Value - 1000 player.HasHouse.Value = true player.PlayerGui.Menu.Frame.House1.Visible = true script.Parent.Parent.Parent.Owned.Value = true script.Parent.Parent.Parent.OwnedBy.Value = player.Name script.Parent.Transparency = 1 script.Parent.CanCollide = false else print("Not enough to purchase house.") end end end)
Hopefully this will help you! :) Good luck!