Phone system buttons

Hey! I’m trying to make it so when I click a button, the destination for the phone changes.

Is it possible to bind the buttons to this value, and then make the script check what the value is?

If this is what you’re trying to do, you can get a value just by doing yourValue.Value.
For the changing part, you can activate a function whenever the player clicks (.Activated) and then set your dest value to whatever you want.

However, you aren’t being very clear with your issue, so if I understood you wrong, explain a little further and I’ll do my best to help you.

Also, Preformatted Text is always better than using screenshots of code.

Give me a sec I’ll send the code

local calling = false
local caller = nil
local animation = nil
local ogspeed = 16
local ogpower = 50
local PhoneCFrame = script.Parent.Phone.CFrame
local otherphone = "PhoneRecepciakancl1"

script.Parent.Configuration.Receiver.Value = game.Workspace[otherphone]

function pickup()
	workspace[otherphone].Click.ClickDetector.MouseClick:Wait()
	workspace[otherphone].Phone.Sound:Stop()
end

function sending(msg, recipient, speaker) 
	local msg = tostring(msg)
	local ChatService = game:GetService("Chat")
	local filteredmessage=ChatService:FilterStringAsync(msg, speaker, speaker) 
	
	game:GetService("Chat"):Chat(script.Parent.Configuration.Receiver.Value.Phone,filteredmessage)
end 

script.Parent.Click.ClickDetector.MouseClick:connect(function(plr)
	if (plr.Character.Head.Position - script.Parent.Main.Position).Magnitude < 5 then	
		if not calling and caller == nil then
			calling = true
			script.CallingVal.Value = true
			caller = plr
			script.Parent.Phone.Changing.TimePosition = 0
			script.Parent.Phone.Changing:Play()
			animation = plr.Character.Humanoid:LoadAnimation(script.Calling)
			animation:Play()
			ogspeed = plr.Character.Humanoid.WalkSpeed
			ogpower = plr.Character.Humanoid.JumpPower
			plr.Character.Humanoid.WalkSpeed = 0
			plr.Character.Humanoid.JumpPower = 0
			script.Parent.Main.RopeConstraint.Attachment0 = nil
			script.Parent.Phone.CFrame = plr.Character.Head.CFrame * CFrame.new(0.6, -0.1,-0.5) * CFrame.Angles(math.rad(-15),math.rad(20),math.rad(180))
			script.Parent.Phone.WeldConstraint.Part1 = plr.Character.Head
			script.Parent.Phone.WeldConstraint.Enabled = true
			script.Parent.Phone.Anchored = false
			if not workspace[otherphone]["Script"].CallingVal.Value then
				workspace[otherphone].Phone.Sound:Play()
				spawn(pickup)
			end
			script.Parent.Main.RopeConstraint.Attachment0 = script.Parent.Main.MainAttachment
			callsend = plr.Chatted:connect(function(msg, recipient) sending(msg, recipient, plr) end)	
			print("started call")
			wait(1)
			script.Parent.Phone.Changing:Stop()
		elseif calling and plr == caller then
			script.Parent.Phone.Changing.TimePosition = 1.7
			script.Parent.Phone.Changing:Resume()
			workspace[otherphone].Phone.Sound:Stop()
			calling = false
			script.CallingVal.Value = false
			caller = nil
			if animation then
				animation:Stop()
			end
			animation = nil
			plr.Character.Humanoid.WalkSpeed = ogspeed
			plr.Character.Humanoid.JumpPower = ogpower
			script.Parent.Phone.WeldConstraint.Part1 = nil
			script.Parent.Phone.WeldConstraint.Enabled = false
			script.Parent.Phone.Anchored = true
			script.Parent.Phone.CFrame = PhoneCFrame
			callsend:Disconnect()
			print("stopped call")
		end	
	end
end)

Basically, I am trying to make it so that when a player presses a button it changes the value (know how to do that), and when I pick up the phone, it checks the destination which the buttons have set

1 Like

Does it check for a specific destination, or do you want to just check the current destination?

I assume function pickup() is what you’re talking about. You can just do

local dest = script.desc.Value
-- do stuff with "desc"

You can also check the destination of the other phone using this method.

Correct me if I don’t understand your issue though, my brain isn’t functioning yet

Current destination, apologies for the late reply school and stuff