Store rob code (E TO ROB)
I would like to know
local Players = game:GetService('Players')
local RunService = game:GetService('RunService')
local UserInputService = game:GetService('UserInputService')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Reward = ReplicatedStorage:WaitForChild('Reward')
local Register = workspace:WaitForChild('Register')
local RobPart = Register:WaitForChild('RobPart')
local HumanoidRootPart = Players.LocalPlayer.Character:WaitForChild('HumanoidRootPart')
local function CheckDistance(Subject)
local Mag = (HumanoidRootPart.Position - Subject.Position).Magntiude
if Mag < 15 then
return
end
end
UserInputService.InputBegan:Connect(function(Input, Typing)
if Typing then return end
if Input.KeyCode == Enum.KeyCode.E or Input.KeyCode == Enum.KeyCode.ButtonY then
if CheckDistance(RobPart) then
Reward:FireServer(RobPart.Reward.Value)
local PlayerGui = Players.LocalPlayer:FindFirstChild('PlayerGui')
local Reward = PlayerGui.Gui.Main:WaitForChild('Reward')
if (Reward) then
Reward.Visible = true
Reward.Description = (RobPart.Reward.Value .. '+ Cash Instead')
delay(3,function()
Reward.Visible = false
end)
end
end
end
end)
local EPrompt = script.EPrompt
local Event
RunService.RenderStepped:Connect(function()
if CheckDistance(RobPart) then
if (Event) then
Event = nil
Event:Disconnect()
end
local NewPrompt = EPrompt:Clone()
NewPrompt.Parent = workspace.CurrentCamera
NewPrompt.Adornee = RobPart
else
for i,key in ipairs(workspace.CurrentCamera:GetChildren()) do
if key:IsA('BillboardGui') then
key:Destroy()
end
end
end
end)