Created
December 8, 2023 11:19
-
-
Save acs/f6114379cfb02f7bf585ffe266da8a67 to your computer and use it in GitHub Desktop.
Spawn in random location
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script.Parent.Touched:Connect(function(hit) | |
if hit.Parent:FindFirstChild("Humanoid") then | |
script.Disabled = true | |
local player = game.Players:GetPlayerFromCharacter(hit.Parent) | |
local equipped = player.Equipped | |
local spawns = game.Workspace.spawns | |
local randSpawn = math.random(1, #spawns:GetChildren()) | |
hit.Parent.HumanoidRootPart.CFrame = game.Workspace:WaitForChild("spawns"):FindFirstChild(randSpawn).CFrame | |
local HandsFold = game:GetService("ServerStorage").Hands | |
local Hand = HandsFold:FindFirstChild(equipped.Value) | |
local ClonedHand = Hand:Clone() | |
ClonedHand.Parent = player.Backpack | |
wait(0.25) | |
script.Disabled = false | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment