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

My script to where you click a textbutton explodes you doesnt work at all. Can someone help me?

Asked by 3 years ago

So i made a small script so when you click a button it explodes and when you hover your mouse over over the button it will explode you. The error is: Players.LordKrox.PlayerGui.ScreenGui.TextButton.LocalScript:5: Expected ')' (to close '(' at column 45), got '.', but when i add the parentheses it says:

Player.LordKrox.PlayerGui.ScreenGui.TextButton.LocalScript:4: Expected identifier when parsing expression, got ')'

The Script is:

local Player =  game.Players.LocalPlayer
local ScreenGui = script.Parent
local TextButton = ScreenGui.Textbutton

TextButton.MouseButton1Down:Connect(function(   Instance.new("Explosion", Player))


    TextButton.MouseButtonHover:Connect(function(print("Click it."))
end)

If you could Help that would be great.

0
its on line 5,add an end) to it CraftyAlphaMan 11 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

you did the functions wrong, first of all, yo'ure putting the script inside the 'function"()"', where the variables would be, and you forgot to add an END for line 5

heres a fixed script :

local Player =  game.Players.LocalPlayer
local ScreenGui = script.Parent
local TextButton = ScreenGui.Textbutton

TextButton.MouseButton1Down:Connect(function()
      Instance.new("Explosion", Player)
end)

 TextButton.MouseButtonHover:Connect(function()
         print("Click it.")
end)
Ad

Answer this question