I have this script that works perfectly with proximity prompt but when i change it to work with textbuttons it doesn’t work, no errors in output (script is localscript inside textbutton)
Here is the proximityprompt script that works:
local ServerScriptService = game:GetService("ServerScriptService")
local ServerStorage = game:GetService("ServerStorage")
local Modules = ServerScriptService:WaitForChild("Modules")
local Engine = require(Modules:WaitForChild("Engine"))
proximity.TriggerEnded:Connect(function(player)
local Character = player.Character or player.CharacterAdded:Wait()
if not ServerStorage:FindFirstChild("Characters") then return end
local CharacterExample = ServerStorage.Characters.CharacterExample
if not CharacterExample then return end
if Character and not Engine:IsZombie(player) and not Engine:IsImmune(player) then
Engine:Zombiefy(player, CharacterExample)
end
end)
and here is the textbutton script that doesn’t work:
local button = script.Parent
local ServerScriptService = game:GetService("ServerScriptService")
local ServerStorage = game:GetService("ServerStorage")
local Modules = ServerScriptService:WaitForChild("Modules")
local Engine = require(Modules:WaitForChild("Engine"))
local function onButtonActivated(player)
local Character = player.Character or player.CharacterAdded:Wait()
if not ServerStorage:FindFirstChild("Characters") then return end
local CharacterExample = ServerStorage.Characters.CharacterExample
if not CharacterExample then return end
if Character and not Engine:IsZombie(player) and not Engine:IsImmune(player) then
Engine:Zombiefy(player, CharacterExample)
end
end
button.Activated:Connect(onButtonActivated)
Any solutions?