#button

27 messages · Page 1 of 1 (latest)

blissful plover
#

okay so i have this issue where the button wont work if its sticked to the object. but if its not it works ? can anyone tell me how tio fix it?

blissful plover
#

here

#

-- Script inside the ColorChangeBlock

-- References to the Part and ProximityPrompt
local part = script.Parent
local proximityPrompt = part:FindFirstChild("ProximityPrompt")

-- Define colors
local originalColor = part.Color
local newColor = Color3.fromRGB(50, 205, 50) -- Lime green color

-- Function to change part color
local function changePartColor()
part.Color = newColor
end

-- Function to reset part color after a delay
local function resetPartColor()
wait(2) -- Duration to hold the new color before resetting
part.Color = originalColor
end

-- Function to award money to the player
local function awardMoney(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local money = leaderstats:FindFirstChild("Money")
if money then
money.Value = money.Value + 10 -- Award 10 money
end
end
end

-- Event listener for the ProximityPrompt Triggered event
proximityPrompt.Triggered:Connect(function(player)
changePartColor()
awardMoney(player)
resetPartColor()
end)

#

this script basically changes color and gives you money when pressed

#

and when i put the part that used as the button it wont work when sticked to the server thingy

#

but if its alone with no object it works perfectly fine

loud current
#

ok so

blissful plover
#

i changed the maxactiviationkey too

#

it still wont work for some reason.

loud current
#

is this a Model and what is the part, is it individual or a model

blissful plover
#

its a simple brick

#

thats neon

#

@loud current

loud current
#

how about this

blissful plover
#

yes?

loud current
#

You'll have to make a leaderstats script in following Devforum post = https://devforum.roblox.com/t/how-to-make-leaderstats-in-roblox-studio-for-beginners/1856471



script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
  script.Parent.Color = Color3.fromRGB(50,205,50)
  local leaderstats = plr:FindFirstChild("leaderstats")
  local money = leaderstats.IntValue.Value
  money = money + 10
  task.wait(2)
  script.Parent.Color = Color3.fromRGB(0,255,255)-- original color goes here (which is cyan)
 end)
blissful plover
#

also, im basically making like a animation if u played flee the facility it will be like that when typing on a keyboard and after 1min of typing animation you get to be able to use the button to install a database in it

zinc stirrupBOT
#

studio** You are now Level 3! **studio

loud current
#

deltatime also adds decimals don't forget.

blissful plover
#

@loud current wouldu be able to help if i pay u?

#

i already got the animation i jkust want it to work

loud current
blissful plover
#

i just dont seem to get it.