#Gui button to change cam type

85 messages · Page 1 of 1 (latest)

bleak peak
#

Onclient event only can be used in localscript

#

if thats what u asking

dawn flume
#

should i switch to a local script?

#

lemme try

bleak peak
#

is the error even from this script sec

#

cuz i looked at the error only lol

misty sageBOT
#

studio** You are now Level 9! **studio

bleak peak
#

yea ok it is in that script

#

and yea it has to be local

dawn flume
bleak peak
#

cuz the code u gave, is executing when remotevent is triggered

#

from server to client

dawn flume
#

i copied and pasted it into this one but changed a few things

bleak peak
#

your script is being executed when remoteevent is fired from server.

#

do you want it to be executed on press of a button?

dawn flume
#

yes

bleak peak
#

is the script inside the button?

#

like is the script's parent a button

dawn flume
#

yes the local script is

bleak peak
#

alright so

#
Local button = script.Parent

button:Activated:Connect(function()
......
#

add the local button

#

and the button:activated - replace your 6th line with this

dawn flume
#

okay

keen stump
#

what

#

first of all

#

its local not Local

#

second

#

why are you using :Activated as a method

#

it should only have a dot not a colon

#

and third, proximityprompts use the .Triggered event

bleak peak
#

i cant tell what he is trying to do

keen stump
bleak peak
#

p sure he has the localscript under button

#

and when button is pressed then do smth

#

maybe am i just dumb

keen stump
#

what button?

#

proximity prompt?

#

text button?

bleak peak
#

IDK i understood button like some gui button

#

lol

keen stump
#

click detector?

#

gui buttons use .MouseButton1click

bleak peak
keen stump
dawn flume
#

yes it supposed to change the camera type back to the default(player cam)

bleak peak
#

it worked for me

#

so

#

¯_(ツ)_/¯

dawn flume
#

when i click the button

bleak peak
#

is the button a gui button

keen stump
#

if its a gui button

bleak peak
#

i swear Activated works too

dawn flume
keen stump
dawn flume
#

does it go right under?

keen stump
#

wym

#

the event is already there

dawn flume
keen stump
#

and then just make it change camera type inside of that funciton

bleak peak
#

replace this with what false gave you

dawn flume
bleak peak
#

without the end) tho

keen stump
#

and to set it back to normal its Enum.CameraType.Custom

#

at this point youre just making the script for them

dawn flume
#

local camera = game.workspace.CurrentCamera
local UIS = game:GetService("UserInputService")
local Camera1 = workspace.Cameras:WaitForChild("CamForDorm")
local player = game.Players.LocalPlayer
local ExitButton = script.Parent

ExitButton.MouseButton1Click:Connect(function()

script.Parent.MouseButton1Click:Connect(function()
    if camera.CameraType == Enum.CameraType.Scriptable then

        Camera1.CFrame = camera.CFrame
    end
end)

end)

#

like this right?

keen stump
#

huh

#

why are you connecting inside a connection

#

for the same thing?

dawn flume
#

so remove the second one?

keen stump
#

uh yeah

dawn flume
keen stump
#

but for some reason youre connecting the same event twice

#

inside the first one

dawn flume
#

local camera = game.workspace.CurrentCamera
local UIS = game:GetService("UserInputService")
local Camera1 = workspace.Cameras:WaitForChild("CamForDorm")
local player = game.Players.LocalPlayer
local ExitButton = script.Parent

ExitButton.MouseButton1Click:Connect(function()

if camera.CameraType == Enum.CameraType.Scriptable then
    
    Camera1.CFrame = camera.CFrame
end

end)

#

it didint do anything