I'm trying to create undertale sign, that after pressing "z", will show you gui with message, but I don't know what's the best way to make it. Here's my script:
--Normal Script
local UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(Input)
local MouseInput = Input.UserInputType
local KeyCode = Input.KeyCode
if KeyCode == Enum.KeyCode.Z then
local player = game.Players.LocalPlayer
if player.PlayerGui:FindFirstChild("TextGui") then return end
if player.Sign.Value == true then
local r = game.ReplicatedStorage.TextGui:Clone()
r.Parent = player.PlayerGui
end
end
end)
--Sign is BoolValue
script.Parent.Touched:Connect(function(hit)
local player = hit.Parent
local player2 = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and player2 then
player.HumanoidRootPart.Anchored = true
player2.Sign.Value = true
end
end)
script.Parent.TouchEnded:Connect(function(hit)
local player = hit.Parent
local player2 = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and player2 then
player2.Sign.Value = false
if player2.PlayerGui:FindFirstChild("TextGui") then
player2.PlayerGui.TextGui:Remove()
end
end
end)

1 comment
Is it in a local script?