Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gui Script Help?

Asked by
abs736 0
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

so i tried making a script so that when you touch a specific block, a gui appears.(im new to scripting). I've tried a ton of stuff but it dosent seem to be working

local stand = game.Workspace.swordstand local player = game.Players.GetPlayers() wait(2) player.PlayerGui.ScreenGui.Kokirisword.Visible = false function onTouch(part) player.PlayerGui.ScreenGui.Kokirisword.Visible = true wait(4) player.PlayerGui.ScreenGui.Kokirisword.Visible = false end

stand.Touched:connect(onTouch)

Anyone know how to fix this?

thanks

1 answer

Log in to vote
0
Answered by
Dummiez 360 Moderation Voter
10 years ago

Put this in the 'swordstand' part.

local part = script.Parent
local debounce = true

part.Touched:connect(function(hit)
    if game.Players:FindFirstChild(hit.Parent.Name) and Workspace:FindFirstChild(hit.Parent.Name).Humanoid and debounce then debounce = false
        local player = game.Players[hit.Parent.Name]
        player.PlayerGui.ScreenGui.Kokirisword.Visible = true
        wait(4)
        player.PlayerGui.ScreenGui.Kokirisword.Visible = false
        debounce = true
    end
end)
Ad

Answer this question