Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local shopPoints = workspace.ServerRef.Lobby.ShopPoints
- local shopArea = {shopPoints.Point1.Position, shopPoints.Point2.Position, shopPoints.Point3.Position, shopPoints.Point4.Position, shopPoints.Point5.Position}
- local function PointWithinArea(Point, Points)
- local Side
- for i = 1, #Points do
- local Point0 = Points[i]
- local Point1 = Points[i == #Points and 1 or i + 1]
- local Value = (Point1 - Point0):Cross(Point - Point0).Y > 0
- if Side ~= nil and Value ~= Side then
- return false
- end
- Side = Value
- end
- return true
- end
- game.Players.LocalPlayer.CharacterAdded:Connect(function(character)
- character:WaitForChild("HumanoidRootPart")
- character.Humanoid.Changed:Connect(function()
- if PointWithinArea(character.HumanoidRootPart.Position, shopArea) then
- game.Players.LocalPlayer.PlayerGui.MainGameGuis.Shop.Visible = true
- else
- game.Players.LocalPlayer.PlayerGui.MainGameGuis.Shop.Visible = false
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement