Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to make this script work with recent updates?

So this script is inside StarterGUI inside a GUI that has a text button, it is a script, not a local script, and it dosen't work anymore, can anyone help?

--[[


--]]
function Click()
script.Parent.Parent.Button.Text = "Teleporting..."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting.."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting..."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting.."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting..."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting."
wait(0.5)
script.Parent.Parent.Button.Text = "Teleporting.."

script.Parent.Parent.Parent.Parent.Character.UpperTorso.CFrame = CFrame.new(0, 0.5, 4.7) -- Place ace location coordinates here!

script.Parent.Parent.Button.Text = "Ready."

wait(2)


script.Parent.Parent.Button.Text = "Teleport"

end


script.Parent.MouseButton1Down:connect(Click)

1 comment

0

I presume you've got FilteringEnabled, therefore any changes to objects should be done by scripts inside ScriptService through use of RemoteEvent, RemoteFunction

2 answers

✓ Accepted answer

Make the script local. Server scripts can only access the GUI through RemoteEvents.

2 comments

1

ok that should have been a comment

0

lol yeah

You need to use a local script to handle the MouseButton1Down event and a server script to handle the change in the UpperTorso's CFrame. With that being said, you'll have to use a remote event to communicate the change. I also included a way to shorten your local script:

--Server script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = Instance.new("RemoteEvent") --create remote
Remote.Parent = ReplicatedStorage

Remote.OnServerEvent:Connect(function(player)
   player.Character.UpperTorso.CFrame = CFrame.new(0,.5,4.7)
end)

--Local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("RemoteEvent") --wait for remote

script.Parent.MouseButton1Down:Connect(function()
	local str = "Teleporting"
	local length = str:len()
	for i = 1,10,.5 do
		wait(.5)
		if str:len() < length + 3 then
			str = str .. "."
      script.Parent.Parent.Button.Text = str
		else str = "Teleporting"
      script.Parent.Parent.Button.Text = str
		end
	end
   Remote:FireServer()
end)

##Resources:

Remote Events


##Accept and upvote if this helps!

This discussion is preserved as it was. New answers, comments, and votes are closed.