Okay, so I was trying to make a script that will give players money in game when they click a button, however I don't know how. Could someone help me? Here's my script.
local Ss = game:GetService("ServerStorage")
local Rs = game:GetService("ReplicatedStorage")
local ws = game:GetService("Workspace")
local plrs = game:GetService("Players")
local db = true
local dialog = Rs:WaitForChild("Dialog")
script.Parent.MouseClick:Connect(function()
if db == true then
db = false
script.Parent.Parent.Size = Vector3.new(0.8, 0.08, 1.21)
script.Parent.Parent.Position = Vector3.new(3.86, 20.546, 12.427)
local events = Ss:WaitForChild("Events")
local availableEvents = events:GetChildren()
local chosenEvent = availableEvents[math.random(1,#availableEvents)]
local clonedEvent = chosenEvent:Clone()
print("Spawning "..clonedEvent.Name.."...")
script.Parent.MaxActivationDistance = 0
clonedEvent.Parent = workspace
script.Parent.Parent.Material = Enum.Material.SmoothPlastic
script.Parent.Parent.Color = Color3.fromRGB(255,0,0)
script.Parent.Parent:WaitForChild("Minecraft Sounds: Piston Out"):Play()
dialog.Value = clonedEvent.Name.."!"
wait(10)
script.Parent.Parent.Size = Vector3.new(0.8, 0.24, 1.21)
print("It's been 10 seconds, so destroying "..clonedEvent.Name.."...")
clonedEvent:Destroy()
script.Parent.Parent.Material = Enum.Material.Neon
script.Parent.Parent.Position = Vector3.new(3.86, 20.59, 12.472)
script.Parent.Parent.Color = Color3.fromRGB(0,255,0)
script.Parent.Parent:WaitForChild("Minecraft Sounds: Piston Out"):Play()
script.Parent.MaxActivationDistance = 32
dialog.Value = "No event!"
db = true
end
end)
[SerpentineKing]: Added Code Block
