Untitled
unknown
plain_text
2 years ago
8.0 kB
6
Indexable
**Soil Placement** --Local Script inside a tool named "Soil" ``` localPlayer = game.Players.LocalPlayer mouse = localPlayer:GetMouse() local tool = script.Parent local SoilFloors = game.Workspace.SoilFloors local ReplicatedStorage = game:GetService("ReplicatedStorage") function DummySoil() PreviewSoil = ReplicatedStorage.SoilPatch:Clone() PreviewSoil.Name = "PreviewSoil" PreviewSoil.Parent = game.Workspace PreviewSoil.Transparency = 0.5 heightOffset = Vector3.new(0, PreviewSoil.Size.Y / 2, 0) mouse.TargetFilter = PreviewSoil mouse.Move:Connect(function() PreviewSoil.Position = mouse.Hit.p + heightOffset end) end function DummySoilRemover() PreviewSoil:Destroy() end tool.Activated:Connect(function() for i, floor in SoilFloors:GetChildren() do if mouse.Target == floor then local PlacedSoil = PreviewSoil:Clone() PlacedSoil.Name = "PlacedSoil" PlacedSoil.Parent = floor PlacedSoil.Transparency = 0 PlacedSoil.Anchored = true PlacedSoil.Position = mouse.Hit.Position + heightOffset tool:Destroy() PreviewSoil:Destroy() print("yes") end end end) tool.Equipped:Connect(DummySoil) tool.Unequipped:Connect(DummySoilRemover) ``` **Sugar Plant Placement** --Local Script inside a tool named "SuagrPlant" ``` localPlayer = game.Players.LocalPlayer mouse = localPlayer:GetMouse() local tool = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local SugarPlantModel = game.ReplicatedStorage.SugarPlantModel local SugarPlantBranch = game.ReplicatedStorage.SugarPlantModel.Branch heightOffset = Vector3.new(0, SugarPlantBranch.Size.Y / 2, 0) tool.Activated:Connect(function() local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = {localPlayer.Character} raycastParams.FilterType = Enum.RaycastFilterType.Exclude local unitRay = mouse.UnitRay local raycastResult = workspace:Raycast(unitRay.Origin, unitRay.Direction * 500, raycastParams) if raycastResult then local RayInstance = raycastResult.Instance if RayInstance.Name == "PlacedSoil" then local PlacedSoilGui = RayInstance:FindFirstChild("BillboardGui") PlacedSoilGui:FindFirstChild("TextLabel").Visible = true print("uh") tool:Destroy() wait(6) PlacedSoilGui:FindFirstChild("TextLabel").Visible = false local PlacedSugarPlant = SugarPlantModel:Clone() PlacedSugarPlant.Name = "PlacedSugarPlant" PlacedSugarPlant.Parent = RayInstance for i, object in ipairs(PlacedSugarPlant:GetChildren()) do if object:IsA("MeshPart") then object.Transparency = 0 object.Position = raycastResult.Position + heightOffset end end end end end) ``` **Robbery Activation** --Script inside Workspace -> CashRegister -> MainBody -> ProximityPrompt ``` local proximityPrompt = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local RobberyActivation = ReplicatedStorage.RobberySystem:WaitForChild("RobberyActivation") proximityPrompt.Triggered:Connect(function(player) RobberyActivation:FireClient(player) end) ``` **Cash Register Robbery** --Local Script inside StarterPlayer -> StartPlayerScripts ``` local Players = game:GetService("Players") local playerGUI = Players.LocalPlayer.PlayerGui local ReplicatedStorage = game:GetService("ReplicatedStorage") local RobberyActivation = ReplicatedStorage.RobberySystem:WaitForChild("RobberyActivation") local RobberyCandyAdder = ReplicatedStorage.RobberySystem:WaitForChild("RobberyCandyAdder") local TIMER = 18 local clickedValue = 0 local endclickedValue = 15 local cashregisterRobbery = playerGUI:WaitForChild("CashRegisterRobbery") local robberySystem = playerGUI.CashRegisterRobbery.Background.RobberySystem local notificationLabel = playerGUI.CashRegisterRobbery.Background.Notification.NotificationLabel local countdownLabel = playerGUI.CashRegisterRobbery.Background.RobberySystem.Countdown local clickerDisplay = playerGUI.CashRegisterRobbery.Background.RobberySystem.ClickerDisplay local crowbarImage = playerGUI.CashRegisterRobbery.Background.RobberySystem.CrowbarImage local startButton = playerGUI.CashRegisterRobbery.Background.RobberySystem.StartButton RobberyActivation.OnClientEvent:Connect(function(player) print("ye") countdownLabel.Text = TIMER clickerDisplay.Text = clickedValue .. "/" .. endclickedValue cashregisterRobbery.Enabled = true notificationLabel.Text = "COLLECT " .. endclickedValue .. " CROWBARS TO SUCCESSFULLY ROB" notificationLabel.TextColor3 = Color3.fromRGB(85, 56, 135) task.wait(0.1) for i = 1, 10, 1 do notificationLabel.TextTransparency -= 0.1 task.wait(0.01) end task.wait(4) for i = 1, 10, 1 do notificationLabel.TextTransparency += 0.1 task.wait(0.01) end robberySystem.Visible = true end) startButton.Activated:Connect(function() startButton.Visible = false task.wait(0.1) crowbarImage.Visible = true for i = 1, TIMER, 1 do TIMER -= 1 countdownLabel.Text = TIMER task.wait(1) end if TIMER == 0 and clickedValue <= endclickedValue and notificationLabel.TextTransparency == 1 then task.wait(0.1) robberySystem.Visible = false TIMER += 18 notificationLabel.Text = "ROBBERY UNSUCCESSFUL" notificationLabel.TextColor3 = Color3.fromRGB(148, 39, 41) for i = 1, 10, 1 do notificationLabel.TextTransparency -= 0.1 task.wait(0.01) end task.wait(3) for i = 1, 10, 1 do notificationLabel.TextTransparency += 0.1 task.wait(0.01) end cashregisterRobbery.Enabled = false startButton.Visible = true crowbarImage.Visible = false clickedValue = 0 notificationLabel.TextTransparency = 1 end end) crowbarImage.Activated:Connect(function() local BorderRadius = 50 local NewCrowbarSizeX = crowbarImage.AbsoluteSize.X local NewCrowbarSizeY = crowbarImage.AbsoluteSize.Y local RobberySystemSizeX = robberySystem.AbsoluteSize.X local RobberySystemSizeY = robberySystem.AbsoluteSize.Y local RangeX = RobberySystemSizeX - BorderRadius * 2 - NewCrowbarSizeX local RangeY = RobberySystemSizeY - BorderRadius * 2 - NewCrowbarSizeY local PositionX = (math.random(RangeX) + BorderRadius + NewCrowbarSizeX / 2) / RobberySystemSizeX local PositionY = (math.random(RangeY) + BorderRadius + NewCrowbarSizeY / 2) / RobberySystemSizeY task.wait(0.1) crowbarImage.Position = UDim2.new(PositionX,0,PositionY,0) clickedValue += 1 clickerDisplay.Text = clickedValue .. "/" .. endclickedValue if clickedValue == endclickedValue then RobberyCandyAdder:FireServer() task.wait(0.1) robberySystem.Visible = false TIMER += 18 notificationLabel.Text = "ROBBERY SUCCESSFUL" notificationLabel.TextColor3 = Color3.fromRGB(55, 148, 41) for i = 1, 10, 1 do notificationLabel.TextTransparency -= 0.1 task.wait(0.01) end task.wait(3) for i = 1, 10, 1 do notificationLabel.TextTransparency += 0.1 task.wait(0.01) end cashregisterRobbery.Enabled = false startButton.Visible = true crowbarImage.Visible = false clickedValue = 0 notificationLabel.TextTransparency = 1 end end) ``` **Robbery Reward Giver** --Script inside ServerScriptService ``` local ReplicatedStorage = game:GetService("ReplicatedStorage") local RobberyCandyAdder = ReplicatedStorage.RobberySystem:WaitForChild("RobberyCandyAdder") RobberyCandyAdder.OnServerEvent:Connect(function(player) local amount = math.random(1,3) local playerCandy = player.CandyStats:FindFirstChild("Candy") if amount == 1 then playerCandy.Value = playerCandy.Value + 500 elseif amount == 2 then playerCandy.Value = playerCandy.Value + 750 elseif amount == 3 then playerCandy.Value = playerCandy.Value + 1000 end end) ```
Editor is loading...