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

Hw do i make script happen for a couple seconds after a block in workspace has been clocked?

this script is a Local script Inside a GUI and I wanna make it happen for a couple seconds after a certain part has been clicked.

--constants

local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer

--Camera

repeat wait() until Player.Character
Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame
script.Parent.Enabled = true

2 comments

0

Do not repeat until something exists. And you just asked a question on this?

0

Put that GUI in ReplicatedStorage, then have the click script clone it into the player's PlayerGui

1 answer

All you have to do is clone the script into the GUI from the script in the part:

-- This is a regular script, mind you
script.Parent.ClickDetector.MouseClick:Connect(function()
	local localscript = game:GetService("ReplicatedStorage"):FindFirstChild("LocalScript")
	if localscript ~= nil then
		local plr = game.Players:GetPlayerFromCharacter(script.Parent)
		if plr then
			localscript:Clone().Parent = plr.PlayerGui.ScreenGui
		end
	end
end)

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